test tree

This commit is contained in:
2023-05-15 09:51:49 +08:00
parent 5400ed7cdc
commit 4b56b2b09c
6 changed files with 69 additions and 86 deletions

View File

@@ -53,7 +53,7 @@ const _sfc_main$1 = defineComponent({
emit("node-click", node);
}
function handleChange(checked, node) {
props.tree.setCheckedKeys(checked, props.checkStrictly, node);
props.tree.setCheckedKeys(checked, props.checkStrictly && props.selectParent, node);
}
function handleIconClick(node) {
node.isLeaf = !node.isLeaf;
@@ -234,7 +234,6 @@ class Tree {
const nodeTitle = Reflect.get(origin, title);
const nodeChildren = Reflect.get(origin, children);
const nodeDisabled = !!Reflect.get(origin, "disabled");
const selectParent = !!Reflect.get(origin, "selectParent");
const nodeIsLeaf = !!Reflect.get(origin, "spread");
const parentNode = nodeMap.get(parentKey);
const node = Object.assign({}, origin, {
@@ -247,8 +246,7 @@ class Tree {
isChecked: false,
isLeaf: false,
hasNextSibling,
parentNode: parentNode || null,
selectParent
parentNode: parentNode || null
});
node.isDisabled = nodeDisabled;
node.isChecked = checkedKeys.includes(nodeKey);
@@ -305,9 +303,6 @@ class Tree {
setCheckedKeys(checked, checkStrictly, node) {
node.isChecked = checked;
console.log(node);
if (node.selectParent) {
return false;
}
if (!checkStrictly) {
if (node.parentNode) {
this.setParentChecked(checked, node.parentNode);