瀏覽代碼

fix: 1. FromDialog组件添加updateItemOptions方法,用于动态更新表单 2. File组件修正一个警告

WANGKANG 5 月之前
父節點
當前提交
96217b761a
共有 2 個文件被更改,包括 11 次插入3 次删除
  1. 10 2
      src/components/FormDialog/index.vue
  2. 1 1
      src/components/Upload/File.vue

+ 10 - 2
src/components/FormDialog/index.vue

@@ -25,7 +25,7 @@
 </template>
 
 <script setup lang="ts" name="FormDialog">
-import { ref, ComputedRef, computed, reactive } from 'vue'
+import { ref, ComputedRef, computed, reactive, nextTick } from 'vue'
 import ProFrom from '@/components/ProForm/index.vue'
 import { ElMessage } from 'element-plus'
 import FileUpload from '@/components/Upload/File.vue'
@@ -150,8 +150,16 @@ const openDialog = (params: FormParameterProps, algoModelId = null) => {
   dialogVisible.value = true
 }
 
+const updateItemOptions = (itemsOptions: ProForm.ItemsOptions[]) => {
+  console.log('updateItemOptions', itemsOptions)
+  nextTick(() => {
+    parameter.value.itemsOptions = Object.assign([], itemsOptions)
+  })
+}
+
 defineExpose({
-  openDialog
+  openDialog,
+  updateItemOptions
 })
 </script>
 

+ 1 - 1
src/components/Upload/File.vue

@@ -66,7 +66,7 @@ interface UploadFileProps {
   icon?: string
   fileType?: Array<string>
   uploadApiPath?: string // 上传文件服务器地址
-  canRemove: boolean // 是否显示删除按钮
+  canRemove?: boolean // 是否显示删除按钮
 }
 
 // 默认值