格式化
This commit is contained in:
parent
adc3f9f7d3
commit
71a3b6f1c4
@ -24,7 +24,7 @@ export interface TreeData {
|
||||
isLeaf: boolean;
|
||||
hasNextSibling: boolean;
|
||||
parentNode: Nullable<TreeData>;
|
||||
selectParent:boolean;
|
||||
selectParent: boolean;
|
||||
}
|
||||
|
||||
export interface TreeNodeProps {
|
||||
@ -37,7 +37,7 @@ export interface TreeNodeProps {
|
||||
collapseTransition: boolean;
|
||||
onlyIconControl: boolean;
|
||||
hideicon?: boolean;
|
||||
selectParent:boolean;
|
||||
selectParent: boolean;
|
||||
}
|
||||
|
||||
interface TreeNodeEmits {
|
||||
@ -83,7 +83,11 @@ function recursiveNodeClick(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) {
|
||||
@ -113,7 +117,7 @@ const isChildAllSelected = computed(() => {
|
||||
for (const item of node.children) {
|
||||
if (item.isChecked) childSelectNum++;
|
||||
}
|
||||
if(!props.selectParent){
|
||||
if (!props.selectParent) {
|
||||
if (childSelectNum > 0) node.isChecked = true; //此处的处理与 checkedKeys 有关联
|
||||
}
|
||||
if (childSelectNum == node.children.length) {
|
||||
@ -129,14 +133,14 @@ const isChildAllSelected = computed(() => {
|
||||
}
|
||||
|
||||
return (node: TreeData): boolean => {
|
||||
console.log(props.selectParent)
|
||||
console.log(props.selectParent);
|
||||
if (props.checkStrictly) {
|
||||
return false;
|
||||
} else if(props.selectParent) {
|
||||
} else if (props.selectParent) {
|
||||
let res = _isChildAllSelected(node);
|
||||
return res;
|
||||
}else{
|
||||
return false
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ const props = withDefaults(defineProps<TreeProps>(), {
|
||||
title: "title",
|
||||
};
|
||||
},
|
||||
selectParent:false
|
||||
selectParent: false,
|
||||
});
|
||||
|
||||
const slots = useSlots();
|
||||
|
@ -94,7 +94,7 @@ class Tree {
|
||||
checkStrictly,
|
||||
replaceFields: { children, id, title },
|
||||
} = this.config;
|
||||
console.log(origin,"origin")
|
||||
console.log(origin, "origin");
|
||||
const nodeKey = Reflect.get(origin, id);
|
||||
const nodeTitle = Reflect.get(origin, title);
|
||||
const nodeChildren = Reflect.get(origin, children);
|
||||
@ -112,7 +112,7 @@ class Tree {
|
||||
isChecked: false,
|
||||
isLeaf: false,
|
||||
hasNextSibling: hasNextSibling,
|
||||
parentNode: parentNode || null
|
||||
parentNode: parentNode || null,
|
||||
});
|
||||
|
||||
node.isDisabled = nodeDisabled;
|
||||
@ -137,7 +137,7 @@ class Tree {
|
||||
}
|
||||
|
||||
setChildrenChecked(checked: boolean, nodes: TreeData[]) {
|
||||
console.log("走赋值子节点了")
|
||||
console.log("走赋值子节点了");
|
||||
var ableCount = 0;
|
||||
var checkCount = 0;
|
||||
const len = nodes.length;
|
||||
@ -164,7 +164,7 @@ class Tree {
|
||||
}
|
||||
|
||||
setParentChecked(checked: boolean, parent: TreeData) {
|
||||
console.log("走赋值父节点了")
|
||||
console.log("走赋值父节点了");
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
@ -185,7 +185,7 @@ class Tree {
|
||||
node: TreeData
|
||||
) {
|
||||
node.isChecked = checked;
|
||||
console.log(node,checkStrictly,186)
|
||||
console.log(node, checkStrictly, 186);
|
||||
if (!checkStrictly) {
|
||||
if (node.parentNode) {
|
||||
this.setParentChecked(checked, node.parentNode);
|
||||
|
Loading…
Reference in New Issue
Block a user