feat: 优化xtselect

This commit is contained in:
caoqianming 2025-12-19 15:46:31 +08:00
parent e5c80121d8
commit 9806e264d8
1 changed files with 5 additions and 7 deletions

View File

@ -89,7 +89,7 @@ const props = defineProps({
options: { type: Array, default: null }, options: { type: Array, default: null },
}); });
const emit = defineEmits(["update:modelValue", "update:obj", "update:label", "change"]); const emit = defineEmits(["update:modelValue", "update:obj", "change"]);
const selectable = (row) => row.count_canhandover?row.count_canhandover>0:true; const selectable = (row) => row.count_canhandover?row.count_canhandover>0:true;
// popover // popover
const showPopover = ref(false); const showPopover = ref(false);
@ -189,8 +189,8 @@ const rowClick = (row) => {
selectLabel.value = row[props.labelField]; selectLabel.value = row[props.labelField];
selectValue.value = row[props.valueField]; selectValue.value = row[props.valueField];
showPopover.value = false; showPopover.value = false;
emit("change", row);
} }
emit("change", selectObj.value);
}; };
const handleClear = () => { const handleClear = () => {
@ -202,8 +202,7 @@ const handleClear = () => {
selectLabel.value = ""; selectLabel.value = "";
selectValue.value = null; selectValue.value = null;
} }
emit("update:label", ""); emit("change", props.multiple ? [] : null);
emit("change", selectObj.value);
}; };
const tdChange = (res, tableData) => { const tdChange = (res, tableData) => {
@ -219,8 +218,7 @@ const selectionChange = (val) => {
selectLabel.value = val selectLabel.value = val
.map((item) => item[props.labelField]) .map((item) => item[props.labelField])
.join(props.splitField); .join(props.splitField);
emit("change", val);
} }
emit("update:label", val);
emit("change", selectObj.value);
}; };
</script> </script>