From ec646c57b8c2d365f5ce298c496e1efaad8456b7 Mon Sep 17 00:00:00 2001 From: open-carp <143722592+open-carp@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:28:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(demo->customerForm):=20FormItem=E4=B8=8B?= =?UTF-8?q?=E6=9C=89=E5=A4=9A=E4=B8=AA=E5=8F=97=E6=8E=A7=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E7=9A=84bug=20(#3238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: FormItem下有多个受控组件控制台显示错误提示的bug * chore(demo->customerForm): use Promise in rule validator --------- Co-authored-by: invalid w --- src/views/demo/form/CustomerForm.vue | 32 +++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/views/demo/form/CustomerForm.vue b/src/views/demo/form/CustomerForm.vue index 4c7fdd160..3e8711a96 100644 --- a/src/views/demo/form/CustomerForm.vue +++ b/src/views/demo/form/CustomerForm.vue @@ -23,17 +23,17 @@ import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; import { CollapseContainer } from '/@/components/Container/index'; import { useMessage } from '/@/hooks/web/useMessage'; - import { Input, FormItem, Select } from 'ant-design-vue'; + import { Input, FormItem, FormItemRest, Select } from 'ant-design-vue'; import { PageWrapper } from '/@/components/Page'; const custom_typeKey2typeValueRules = (model) => { return [ { required: true, - validator: (rule, value, callback) => { - if (!model.typeKey) return callback('请选择类型'); - if (!model.typeValue) return callback('请输入数据'); - callback(); + validator: async () => { + if (!model.typeKey) return Promise.reject('请选择类型'); + if (!model.typeValue) return Promise.reject('请输入数据'); + Promise.resolve(); }, }, ]; @@ -145,7 +145,13 @@ 测试名称 - + + + ); @@ -183,12 +189,14 @@ 公司名称 产品名称 - + + + );