记录下在tsx文件中如何使用loading
众所周知tsx中用不了vue指令,我在实际项目中也遇到了这个问题,记录一下
import { withDirectives, ref } from 'vue'; // 导入方法
import { ElLoadingDirective } from 'element-plus'; // 导入loading指令
const loading = ref(false)
// 返回的dom
return () => {
return (
<>
{withDirectives(<div>内容</div>, [[ElLoadingDirective, loading.value]])}
</>
)
)