From 75c979e908357483955c83c25f30322efa4ea269 Mon Sep 17 00:00:00 2001 From: tiancheng Date: Wed, 28 Feb 2024 19:11:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?add:=20=E5=8D=95=E9=80=89=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=E8=BF=94=E5=9B=9EID=E4=B8=8D=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ma-form/formItem/form-user-select.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/ma-form/formItem/form-user-select.vue b/src/components/ma-form/formItem/form-user-select.vue index d114ed1b..c5c46a96 100644 --- a/src/components/ma-form/formItem/form-user-select.vue +++ b/src/components/ma-form/formItem/form-user-select.vue @@ -36,12 +36,16 @@ const props = defineProps({ customField: { type: String, default: undefined } }) + const formModel = inject('formModel') const index = props.customField ?? props.component.dataIndex const value = ref(get(formModel.value, index)) watch( () => get(formModel.value, index), vl => value.value = vl ) watch( () => value.value, v => { + if(props.component.multiple === false && v.length === 1) { + v = v.shift(); + } set(formModel.value, index, v) index.indexOf('.') > -1 && delete formModel.value[index] } ) From 3754af4c2690a7aa5e69e75dce4d881896542462 Mon Sep 17 00:00:00 2001 From: tiancheng Date: Wed, 28 Feb 2024 19:16:44 +0800 Subject: [PATCH 2/2] fixed --- src/components/ma-form/formItem/form-user-select.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/ma-form/formItem/form-user-select.vue b/src/components/ma-form/formItem/form-user-select.vue index c5c46a96..234c19e4 100644 --- a/src/components/ma-form/formItem/form-user-select.vue +++ b/src/components/ma-form/formItem/form-user-select.vue @@ -36,7 +36,6 @@ const props = defineProps({ customField: { type: String, default: undefined } }) - const formModel = inject('formModel') const index = props.customField ?? props.component.dataIndex const value = ref(get(formModel.value, index)) @@ -44,7 +43,7 @@ const value = ref(get(formModel.value, index)) watch( () => get(formModel.value, index), vl => value.value = vl ) watch( () => value.value, v => { if(props.component.multiple === false && v.length === 1) { - v = v.shift(); + v = v.shift(); } set(formModel.value, index, v) index.indexOf('.') > -1 && delete formModel.value[index]