add tree hideicon

This commit is contained in:
Theluyuan 2023-04-25 09:16:07 +08:00
parent 392b2d1547
commit e293b80814
2 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,7 @@ export interface TreeNodeProps {
checkStrictly: boolean | string; checkStrictly: boolean | string;
collapseTransition: boolean; collapseTransition: boolean;
onlyIconControl: boolean; onlyIconControl: boolean;
hideicon?: boolean;
} }
interface TreeNodeEmits { interface TreeNodeEmits {
@ -69,6 +70,9 @@ const nodeIconType = (node: TreeData): string => {
if (node.children.length !== 0) { if (node.children.length !== 0) {
return !node.isLeaf ? "layui-icon-addition" : "layui-icon-subtraction"; return !node.isLeaf ? "layui-icon-addition" : "layui-icon-subtraction";
} }
if(props.hideicon){
return ""
}
return "layui-icon-file"; return "layui-icon-file";
}; };
@ -193,6 +197,7 @@ const isChildAllSelected = computed(() => {
:collapse-transition="collapseTransition" :collapse-transition="collapseTransition"
:checkStrictly="checkStrictly" :checkStrictly="checkStrictly"
:only-icon-control="onlyIconControl" :only-icon-control="onlyIconControl"
:hideico="props.hideicon"
@node-click="recursiveNodeClick" @node-click="recursiveNodeClick"
> >
<template v-if="$slots.title" v-slot:title="slotProp: { data: any }"> <template v-if="$slots.title" v-slot:title="slotProp: { data: any }">

View File

@ -38,6 +38,7 @@ export interface TreeProps {
showLine?: boolean; showLine?: boolean;
showCheckbox?: boolean; showCheckbox?: boolean;
replaceFields?: ReplaceFieldsOptions; replaceFields?: ReplaceFieldsOptions;
hideicon?:boolean;
} }
interface TreeEmits { interface TreeEmits {
@ -144,6 +145,7 @@ function handleClick(node: TreeData) {
:collapse-transition="collapseTransition" :collapse-transition="collapseTransition"
:only-icon-control="onlyIconControl" :only-icon-control="onlyIconControl"
@node-click="handleClick" @node-click="handleClick"
:hideico="props.hideicon"
> >
<template v-if="$slots.title" v-slot:title="{ data }"> <template v-if="$slots.title" v-slot:title="{ data }">
<slot name="title" :data="data"></slot> <slot name="title" :data="data"></slot>