Pre Merge pull request !17 from huorexiaji/master

This commit is contained in:
huorexiaji 2024-01-15 13:49:14 +00:00 committed by Gitee
commit 7b4cc8815b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -58,8 +58,10 @@
// -------------------------- -------------------------- // -------------------------- --------------------------
let valueIsArray = ref(false);
const dictValueList = ref([]); const dictValueList = ref([]);
async function queryDict() { async function queryDict() {
valueIsArray = Array.isArray(props.value)
let res = await dictApi.valueList(props.keyCode); let res = await dictApi.valueList(props.keyCode);
dictValueList.value = res.data; dictValueList.value = res.data;
} }
@ -102,7 +104,7 @@
emit('change', selected); emit('change', selected);
return selected; return selected;
} }
if (Array.isArray(props.value)) { if (valueIsArray) {
let valueList = dictValueList.value.filter((e) => value.includes(e.valueCode)); let valueList = dictValueList.value.filter((e) => value.includes(e.valueCode));
valueList = valueList.map((e) => e.valueCode); valueList = valueList.map((e) => e.valueCode);
emit('update:value', valueList); emit('update:value', valueList);