格式化
This commit is contained in:
		
							parent
							
								
									9ce9d66cbe
								
							
						
					
					
						commit
						70b082a208
					
				@ -83,7 +83,11 @@ function recursiveNodeClick(node: TreeData) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function handleChange(checked: boolean, node: TreeData) {
 | 
					function handleChange(checked: boolean, node: TreeData) {
 | 
				
			||||||
  props.tree.setCheckedKeys(checked, props.checkStrictly || props.selectParent, node);
 | 
					  props.tree.setCheckedKeys(
 | 
				
			||||||
 | 
					    checked,
 | 
				
			||||||
 | 
					    props.checkStrictly || props.selectParent,
 | 
				
			||||||
 | 
					    node
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function handleIconClick(node: TreeData) {
 | 
					function handleIconClick(node: TreeData) {
 | 
				
			||||||
@ -129,14 +133,14 @@ const isChildAllSelected = computed(() => {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (node: TreeData): boolean => {
 | 
					  return (node: TreeData): boolean => {
 | 
				
			||||||
    console.log(props.selectParent)
 | 
					    console.log(props.selectParent);
 | 
				
			||||||
    if (props.checkStrictly) {
 | 
					    if (props.checkStrictly) {
 | 
				
			||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    } else if (props.selectParent) {
 | 
					    } else if (props.selectParent) {
 | 
				
			||||||
      let res = _isChildAllSelected(node);
 | 
					      let res = _isChildAllSelected(node);
 | 
				
			||||||
      return res;
 | 
					      return res;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      return false
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
@ -66,7 +66,7 @@ const props = withDefaults(defineProps<TreeProps>(), {
 | 
				
			|||||||
      title: "title",
 | 
					      title: "title",
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  selectParent:false
 | 
					  selectParent: false,
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const slots = useSlots();
 | 
					const slots = useSlots();
 | 
				
			||||||
 | 
				
			|||||||
@ -94,7 +94,7 @@ class Tree {
 | 
				
			|||||||
      checkStrictly,
 | 
					      checkStrictly,
 | 
				
			||||||
      replaceFields: { children, id, title },
 | 
					      replaceFields: { children, id, title },
 | 
				
			||||||
    } = this.config;
 | 
					    } = this.config;
 | 
				
			||||||
    console.log(origin,"origin")
 | 
					    console.log(origin, "origin");
 | 
				
			||||||
    const nodeKey = Reflect.get(origin, id);
 | 
					    const nodeKey = Reflect.get(origin, id);
 | 
				
			||||||
    const nodeTitle = Reflect.get(origin, title);
 | 
					    const nodeTitle = Reflect.get(origin, title);
 | 
				
			||||||
    const nodeChildren = Reflect.get(origin, children);
 | 
					    const nodeChildren = Reflect.get(origin, children);
 | 
				
			||||||
@ -112,7 +112,7 @@ class Tree {
 | 
				
			|||||||
      isChecked: false,
 | 
					      isChecked: false,
 | 
				
			||||||
      isLeaf: false,
 | 
					      isLeaf: false,
 | 
				
			||||||
      hasNextSibling: hasNextSibling,
 | 
					      hasNextSibling: hasNextSibling,
 | 
				
			||||||
      parentNode: parentNode || null
 | 
					      parentNode: parentNode || null,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    node.isDisabled = nodeDisabled;
 | 
					    node.isDisabled = nodeDisabled;
 | 
				
			||||||
@ -137,7 +137,7 @@ class Tree {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setChildrenChecked(checked: boolean, nodes: TreeData[]) {
 | 
					  setChildrenChecked(checked: boolean, nodes: TreeData[]) {
 | 
				
			||||||
    console.log("走赋值子节点了")
 | 
					    console.log("走赋值子节点了");
 | 
				
			||||||
    var ableCount = 0;
 | 
					    var ableCount = 0;
 | 
				
			||||||
    var checkCount = 0;
 | 
					    var checkCount = 0;
 | 
				
			||||||
    const len = nodes.length;
 | 
					    const len = nodes.length;
 | 
				
			||||||
@ -164,7 +164,7 @@ class Tree {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setParentChecked(checked: boolean, parent: TreeData) {
 | 
					  setParentChecked(checked: boolean, parent: TreeData) {
 | 
				
			||||||
    console.log("走赋值父节点了")
 | 
					    console.log("走赋值父节点了");
 | 
				
			||||||
    if (!parent) {
 | 
					    if (!parent) {
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -185,7 +185,7 @@ class Tree {
 | 
				
			|||||||
    node: TreeData
 | 
					    node: TreeData
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    node.isChecked = checked;
 | 
					    node.isChecked = checked;
 | 
				
			||||||
    console.log(node,checkStrictly,186)
 | 
					    console.log(node, checkStrictly, 186);
 | 
				
			||||||
    if (!checkStrictly) {
 | 
					    if (!checkStrictly) {
 | 
				
			||||||
      if (node.parentNode) {
 | 
					      if (node.parentNode) {
 | 
				
			||||||
        this.setParentChecked(checked, node.parentNode);
 | 
					        this.setParentChecked(checked, node.parentNode);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user