add 树型框可以不半选父级
This commit is contained in:
@@ -36,6 +36,7 @@ export interface TreeNodeProps {
|
||||
collapseTransition: boolean;
|
||||
onlyIconControl: boolean;
|
||||
hideicon?: boolean;
|
||||
selectParent:boolean;
|
||||
}
|
||||
|
||||
interface TreeNodeEmits {
|
||||
@@ -130,9 +131,11 @@ const isChildAllSelected = computed(() => {
|
||||
return (node: TreeData): boolean => {
|
||||
if (props.checkStrictly) {
|
||||
return false;
|
||||
} else {
|
||||
} else if(props.selectParent) {
|
||||
let res = _isChildAllSelected(node);
|
||||
return res;
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -198,6 +201,7 @@ const isChildAllSelected = computed(() => {
|
||||
:checkStrictly="checkStrictly"
|
||||
:only-icon-control="onlyIconControl"
|
||||
:hideicon="props.hideicon"
|
||||
:select-parent="props.selectParent"
|
||||
@node-click="recursiveNodeClick"
|
||||
>
|
||||
<template v-if="$slots.title" v-slot:title="slotProp: { data: any }">
|
||||
|
||||
@@ -39,6 +39,7 @@ export interface TreeProps {
|
||||
showCheckbox?: boolean;
|
||||
replaceFields?: ReplaceFieldsOptions;
|
||||
hideicon?: boolean;
|
||||
selectParent?: boolean;
|
||||
}
|
||||
|
||||
interface TreeEmits {
|
||||
@@ -65,6 +66,7 @@ const props = withDefaults(defineProps<TreeProps>(), {
|
||||
title: "title",
|
||||
};
|
||||
},
|
||||
selectParent:true
|
||||
});
|
||||
|
||||
const slots = useSlots();
|
||||
@@ -146,6 +148,7 @@ function handleClick(node: TreeData) {
|
||||
:only-icon-control="onlyIconControl"
|
||||
@node-click="handleClick"
|
||||
:hideicon="props.hideicon"
|
||||
:selectParent="props.selectParent"
|
||||
>
|
||||
<template v-if="$slots.title" v-slot:title="{ data }">
|
||||
<slot name="title" :data="data"></slot>
|
||||
|
||||
Reference in New Issue
Block a user