Commit 237f41da68592ede236b722157c91f9d7b45db1b
1 parent
5c57a1dd
fix(form): ensure that the hidden fields of the form are verified properly, fix #413
Showing
4 changed files
with
12 additions
and
3 deletions
CHANGELOG.zh_CN.md
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
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', |