Commit 237f41da68592ede236b722157c91f9d7b45db1b

Authored by Vben
1 parent 5c57a1dd

fix(form): ensure that the hidden fields of the form are verified properly, fix #413

CHANGELOG.zh_CN.md
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
20 - 确保 progress 进度条正确关闭 20 - 确保 progress 进度条正确关闭
21 - 修复表格勾选列配置失效问题 21 - 修复表格勾选列配置失效问题
22 - 确保一级菜单可以被隐藏 22 - 确保一级菜单可以被隐藏
  23 +- 确保表单隐藏字段校验正常
23 24
24 ### 🎫 Chores 25 ### 🎫 Chores
25 26
src/components/Form/src/components/FormItem.vue
@@ -156,9 +156,9 @@ @@ -156,9 +156,9 @@
156 if (!isShow) { 156 if (!isShow) {
157 rule.required = false; 157 rule.required = false;
158 } 158 }
159 - if (rule.required && component) { 159 + if (component) {
160 if (!Reflect.has(rule, 'type')) { 160 if (!Reflect.has(rule, 'type')) {
161 - rule.type = 'string'; 161 + rule.type = component === 'InputNumber' ? 'number' : 'string';
162 } 162 }
163 const joinLabel = Reflect.has(props.schema, 'rulesMessageJoinLabel') 163 const joinLabel = Reflect.has(props.schema, 'rulesMessageJoinLabel')
164 ? rulesMessageJoinLabel 164 ? rulesMessageJoinLabel
src/design/ant/index.less
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 } 14 }
15 15
16 span.anticon:not(.app-iconify) { 16 span.anticon:not(.app-iconify) {
17 - vertical-align: 0.135em; 17 + vertical-align: 0.125em !important;
18 } 18 }
19 19
20 .ant-back-top { 20 .ant-back-top {
src/views/demo/form/RuleForm.vue
@@ -39,6 +39,14 @@ @@ -39,6 +39,14 @@
39 required: true, 39 required: true,
40 }, 40 },
41 { 41 {
  42 + field: 'id',
  43 + label: 'id',
  44 + required: true,
  45 + defaultValue: 0,
  46 + component: 'InputNumber',
  47 + show: false,
  48 + },
  49 + {
42 field: 'field3', 50 field: 'field3',
43 component: 'DatePicker', 51 component: 'DatePicker',
44 label: '字段3', 52 label: '字段3',