fix table重新渲染会修改props

This commit is contained in:
2023-05-18 14:35:17 +08:00
parent 71a3b6f1c4
commit 9c7280105d
7 changed files with 98 additions and 69 deletions

View File

@@ -1058,7 +1058,7 @@ const _sfc_main = defineComponent({
});
};
findFinalNode(0, tableColumns.value);
const tableSelectedKeys = ref([...props.selectedKeys]);
const tableSelectedKeys = ref(props.selectedKeys);
const tableExpandKeys = ref([...props.expandKeys]);
watch(() => props.selectedKeys, () => {
tableSelectedKeys.value = props.selectedKeys;
@@ -1102,7 +1102,10 @@ const _sfc_main = defineComponent({
} else {
hasChecked.value = false;
}
emit("update:selectedKeys", tableSelectedKeys.value);
if (tableSelectedKeys.value != props.selectedKeys) {
console.log("\u521D\u59CB\u5316\u8D4B\u503C\u89E6\u53D1\u4FEE\u6539", tableSelectedKeys.value, props.selectedKeys);
emit("update:selectedKeys", tableSelectedKeys.value);
}
}, { deep: true, immediate: true });
watch(tableExpandKeys, () => {
emit("update:expandKeys", tableExpandKeys.value);