Browse Source

perf: 更新demo

kailong321200875 1 year ago
parent
commit
59a3f5eb07
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/views/Components/Form/DefaultForm.vue

+ 12 - 2
src/views/Components/Form/DefaultForm.vue

@@ -442,6 +442,15 @@ const treeSelectData = [
   }
 ]
 
+// 模拟远程加载
+const getTreeSelectData = () => {
+  return new Promise((resolve) => {
+    setTimeout(() => {
+      resolve(treeSelectData)
+    }, 3000)
+  })
+}
+
 let id = 0
 
 const imageUrl = ref('')
@@ -1533,8 +1542,9 @@ const schema = reactive<FormSchema[]>([
     label: `${t('formDemo.treeSelect')}`,
     component: 'TreeSelect',
     // 远程加载option
-    optionApi: () => {
-      return treeSelectData
+    optionApi: async () => {
+      const res = await getTreeSelectData()
+      return res
     }
   },
   {