diff --git a/packages/form/src/containers/Table.vue b/packages/form/src/containers/Table.vue index 02c92e0df..4c4274d7e 100644 --- a/packages/form/src/containers/Table.vue +++ b/packages/form/src/containers/Table.vue @@ -120,41 +120,46 @@ - 新增一行 -   - 展开配置 - - {{ isFullscreen ? '退出全屏' : '全屏编辑' }} - - - 导入EXCEL   - 清空 + +
+ 新增一行 + +
+ 展开配置 + + {{ isFullscreen ? '退出全屏' : '全屏编辑' }} + + + 导入EXCEL + + 清空 +
+
{ emit('change', props.model[modelName.value]); }; -if (!(globalThis as any).XLSX) { - asyncLoadJs('https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js'); -} - onMounted(() => { if (props.config.defautSort) { sortChange(props.config.defautSort); @@ -535,10 +536,15 @@ const clearHandler = () => { mForm?.$emit('field-change', props.prop, props.model[modelName.value]); }; -const excelHandler = (file: any) => { +const excelHandler = async (file: any) => { if (!file?.raw) { return false; } + + if (!(globalThis as any).XLSX) { + await asyncLoadJs('https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js'); + } + const reader = new FileReader(); reader.onload = () => { const data = reader.result;