diff --git a/src/components/xtSelect/index.vue b/src/components/xtSelect/index.vue index 902d2a23..94c622a5 100644 --- a/src/components/xtSelect/index.vue +++ b/src/components/xtSelect/index.vue @@ -89,7 +89,7 @@ const props = defineProps({ 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; // 控制 popover 显示与隐藏的状态 const showPopover = ref(false); @@ -189,8 +189,8 @@ const rowClick = (row) => { selectLabel.value = row[props.labelField]; selectValue.value = row[props.valueField]; showPopover.value = false; + emit("change", row); } - emit("change", selectObj.value); }; const handleClear = () => { @@ -202,8 +202,7 @@ const handleClear = () => { selectLabel.value = ""; selectValue.value = null; } - emit("update:label", ""); - emit("change", selectObj.value); + emit("change", props.multiple ? [] : null); }; const tdChange = (res, tableData) => { @@ -219,8 +218,7 @@ const selectionChange = (val) => { selectLabel.value = val .map((item) => item[props.labelField]) .join(props.splitField); - } - emit("update:label", val); - emit("change", selectObj.value); + emit("change", val); + } };