Преглед на файлове

fix: fix useCrudSchemas not work

kailong321200875 преди 2 години
родител
ревизия
0a855b93e2
променени са 3 файла, в които са добавени 9 реда и са изтрити 5 реда
  1. 3 2
      src/components/Search/src/Search.vue
  2. 3 3
      src/hooks/web/useCrudSchemas.ts
  3. 3 0
      src/views/Example/Dialog/ExampleDialog.vue

+ 3 - 2
src/components/Search/src/Search.vue

@@ -31,7 +31,8 @@ const props = defineProps({
   // 是否显示伸缩
   expand: propTypes.bool.def(false),
   // 伸缩的界限字段
-  expandField: propTypes.string.def('')
+  expandField: propTypes.string.def(''),
+  inline: propTypes.bool.def(true)
 })
 
 const emit = defineEmits(['search', 'reset'])
@@ -96,7 +97,7 @@ const setVisible = () => {
     :is-custom="false"
     :label-width="labelWidth"
     hide-required-asterisk
-    inline
+    :inline="inline"
     :is-col="isCol"
     :schema="newSchema"
     @register="register"

+ 3 - 3
src/hooks/web/useCrudSchemas.ts

@@ -169,10 +169,10 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
 
   eachTree(crudSchema, (schemaItem: CrudSchema) => {
     // 判断是否显示
-    if (schemaItem?.form?.show) {
+    if (schemaItem?.form?.show !== false) {
       const formSchemaItem = {
         // 默认为 input
-        component: schemaItem.form.component || 'Input',
+        component: schemaItem?.form?.component || 'Input',
         componentProps: {},
         ...schemaItem.form,
         field: schemaItem.field,
@@ -211,7 +211,7 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
   for (const task of formRequestTask) {
     task()
   }
-
+  console.log(formSchema)
   return formSchema
 }
 

+ 3 - 0
src/views/Example/Dialog/ExampleDialog.vue

@@ -90,6 +90,9 @@ const crudSchemas = reactive<CrudSchema[]>([
     form: {
       component: 'Select',
       componentProps: {
+        style: {
+          width: '100%'
+        },
         options: [
           {
             label: '重要',