feat: 优化xtselect
This commit is contained in:
parent
e5c80121d8
commit
9806e264d8
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue