From a0af1c2f4bcfdcb295b8712fc2d845b20979a363 Mon Sep 17 00:00:00 2001 From: Halo Dev Bot <87291978+halo-dev-bot@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:07:37 +0800 Subject: [PATCH] [release-2.19] fix: formkit selector not listening to data after defaulting to first option (#6574) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an automated cherry-pick of #6571 /assign LIlGG ```release-note 解决 formkit 选择器回显数据异常的问题 ``` --- ui/src/formkit/inputs/select/SelectMain.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/src/formkit/inputs/select/SelectMain.vue b/ui/src/formkit/inputs/select/SelectMain.vue index 15cb446e9..9744df0a0 100644 --- a/ui/src/formkit/inputs/select/SelectMain.vue +++ b/ui/src/formkit/inputs/select/SelectMain.vue @@ -576,9 +576,15 @@ watch( } ); +const handleSelectedUpdate = ( + value: Array<{ label: string; value: string }> +) => { + stopSelectedWatch(); + handleUpdate(value); +}; + const handleUpdate = (value: Array<{ label: string; value: string }>) => { const values = value.map((item) => item.value); - stopSelectedWatch(); selectOptions.value = value; if (selectProps.multiple) { props.context.node.input(values); @@ -714,7 +720,7 @@ const handleNextPage = async () => { :clearable="selectProps.clearable" :searchable="selectProps.searchable" :auto-select="selectProps.autoSelect" - @update="handleUpdate" + @update="handleSelectedUpdate" @search="handleSearch" @load-more="handleNextPage" />