mirror of https://github.com/halo-dev/halo
[release-2.19] fix: formkit selector not listening to data after defaulting to first option (#6574)
This is an automated cherry-pick of #6571 /assign LIlGG ```release-note 解决 formkit 选择器回显数据异常的问题 ```pull/6576/head
parent
142f46b435
commit
a0af1c2f4b
|
@ -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"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue