fix: Single line multi select cards (#3977)
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
shaohuzhang1 2025-09-01 19:04:45 +08:00 committed by GitHub
parent d9ad9aabf2
commit f6e9bf6483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,12 +37,17 @@ const selected = (activeValue: string | number) => {
props.modelValue.filter((i: any) => i != activeValue),
)
} else {
emit('update:modelValue', props.modelValue ? [...props.modelValue, activeValue] : [activeValue])
emit('update:modelValue', reset(activeValue))
}
if (elFormItem?.validate) {
elFormItem.validate('change')
}
}
const reset = (activeValue: string) => {
const _result = props.modelValue ? [...props.modelValue, activeValue] : [activeValue]
return _result.filter((r) => option_value_list.value.includes(r))
}
const _value = computed(() => {
return props.modelValue ? props.modelValue : []
})
@ -55,7 +60,9 @@ const textField = computed(() => {
const valueField = computed(() => {
return props.formField.value_field ? props.formField.value_field : 'value'
})
const option_value_list = computed(() => {
return option_list.value.map((item) => item[valueField.value])
})
const option_list = computed(() => {
return props.formField.option_list ? props.formField.option_list : []
})