Sfoglia il codice sorgente

perf(form组件): 新增部分字段

fxs 1 giorno fa
parent
commit
7b424024ec

+ 8 - 0
src/components/common/CustomDialog.vue

@@ -116,12 +116,20 @@ const encrypt = (fields: string, useFormField: boolean, encryptMsg: Array<string
   })
 }
 
+/**
+ * @description: 获取表单数据
+ */
+const getFormData = () => {
+  return dialogFormRef.value?.getFormData()
+}
+
 onMounted(() => {
   dialogConfig.title = dialogConfigInfo.title
   addUrl.value = props.config.reqConfig.url // 保存一下新增的URL
 })
 
 defineExpose({
+  getFormData,
   addForm,
   editForm,
   encrypt

+ 1 - 0
src/components/form/CustomForm.vue

@@ -212,6 +212,7 @@ defineExpose({
             :placeholder="item.otherOptions.placeholder"
             size="default"
             :id="item.name"
+            :filterable="item.otherOptions.searchSelected"
           >
             <el-option
               v-for="val in item.otherOptions.options"

+ 1 - 0
src/types/form.ts

@@ -20,6 +20,7 @@ export interface FormField {
   otherOptions?: {
     placeholder?: string
     tip?: string | (() => string | VNode)
+    searchSelected?: boolean // 选择框是否可搜索,此选项只对select生效
     options?: Array<{ name: string; label: string; value: any }>
   }
 }