fix tree hideicon

This commit is contained in:
Theluyuan 2023-04-25 09:25:44 +08:00
parent e293b80814
commit eab2a7b52e
5 changed files with 28 additions and 14 deletions

View File

@ -23,7 +23,8 @@ const _sfc_main$1 = defineComponent({
selectedKey: null, selectedKey: null,
checkStrictly: { type: [Boolean, String] }, checkStrictly: { type: [Boolean, String] },
collapseTransition: { type: Boolean }, collapseTransition: { type: Boolean },
onlyIconControl: { type: Boolean } onlyIconControl: { type: Boolean },
hideicon: { type: Boolean }
}, },
emits: ["node-click"], emits: ["node-click"],
setup(__props, { emit }) { setup(__props, { emit }) {
@ -42,6 +43,9 @@ const _sfc_main$1 = defineComponent({
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";
}; };
function recursiveNodeClick(node) { function recursiveNodeClick(node) {
@ -161,6 +165,7 @@ const _sfc_main$1 = defineComponent({
"collapse-transition": __props.collapseTransition, "collapse-transition": __props.collapseTransition,
checkStrictly: __props.checkStrictly, checkStrictly: __props.checkStrictly,
"only-icon-control": __props.onlyIconControl, "only-icon-control": __props.onlyIconControl,
hideicon: props.hideicon,
onNodeClick: recursiveNodeClick onNodeClick: recursiveNodeClick
}, createSlots({ _: 2 }, [ }, createSlots({ _: 2 }, [
_ctx.$slots.title ? { _ctx.$slots.title ? {
@ -172,7 +177,7 @@ const _sfc_main$1 = defineComponent({
]), ]),
key: "0" key: "0"
} : void 0 } : void 0
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control"]) ]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control", "hideicon"])
])) : createCommentVNode("", true) ])) : createCommentVNode("", true)
]), ]),
_: 2 _: 2
@ -377,7 +382,8 @@ const _sfc_main = defineComponent({
children: "children", children: "children",
title: "title" title: "title"
}; };
} } } },
hideicon: { type: Boolean }
}, },
emits: ["update:checkedKeys", "update:expandKeys", "node-click"], emits: ["update:checkedKeys", "update:expandKeys", "node-click"],
setup(__props, { emit }) { setup(__props, { emit }) {
@ -439,7 +445,8 @@ const _sfc_main = defineComponent({
"check-strictly": __props.checkStrictly, "check-strictly": __props.checkStrictly,
"collapse-transition": __props.collapseTransition, "collapse-transition": __props.collapseTransition,
"only-icon-control": __props.onlyIconControl, "only-icon-control": __props.onlyIconControl,
onNodeClick: handleClick onNodeClick: handleClick,
hideicon: props.hideicon
}, createSlots({ _: 2 }, [ }, createSlots({ _: 2 }, [
_ctx.$slots.title ? { _ctx.$slots.title ? {
name: "title", name: "title",
@ -448,7 +455,7 @@ const _sfc_main = defineComponent({
]), ]),
key: "0" key: "0"
} : void 0 } : void 0
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control"]) ]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control", "hideicon"])
], 2); ], 2);
}; };
} }

View File

@ -17620,7 +17620,8 @@ const _sfc_main$K = defineComponent({
selectedKey: null, selectedKey: null,
checkStrictly: { type: [Boolean, String] }, checkStrictly: { type: [Boolean, String] },
collapseTransition: { type: Boolean }, collapseTransition: { type: Boolean },
onlyIconControl: { type: Boolean } onlyIconControl: { type: Boolean },
hideicon: { type: Boolean }
}, },
emits: ["node-click"], emits: ["node-click"],
setup(__props, { emit }) { setup(__props, { emit }) {
@ -17639,6 +17640,9 @@ const _sfc_main$K = defineComponent({
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";
}; };
function recursiveNodeClick(node) { function recursiveNodeClick(node) {
@ -17758,6 +17762,7 @@ const _sfc_main$K = defineComponent({
"collapse-transition": __props.collapseTransition, "collapse-transition": __props.collapseTransition,
checkStrictly: __props.checkStrictly, checkStrictly: __props.checkStrictly,
"only-icon-control": __props.onlyIconControl, "only-icon-control": __props.onlyIconControl,
hideicon: props.hideicon,
onNodeClick: recursiveNodeClick onNodeClick: recursiveNodeClick
}, createSlots({ _: 2 }, [ }, createSlots({ _: 2 }, [
_ctx.$slots.title ? { _ctx.$slots.title ? {
@ -17769,7 +17774,7 @@ const _sfc_main$K = defineComponent({
]), ]),
key: "0" key: "0"
} : void 0 } : void 0
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control"]) ]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control", "hideicon"])
])) : createCommentVNode("", true) ])) : createCommentVNode("", true)
]), ]),
_: 2 _: 2
@ -17974,7 +17979,8 @@ const _sfc_main$J = defineComponent({
children: "children", children: "children",
title: "title" title: "title"
}; };
} } } },
hideicon: { type: Boolean }
}, },
emits: ["update:checkedKeys", "update:expandKeys", "node-click"], emits: ["update:checkedKeys", "update:expandKeys", "node-click"],
setup(__props, { emit }) { setup(__props, { emit }) {
@ -18036,7 +18042,8 @@ const _sfc_main$J = defineComponent({
"check-strictly": __props.checkStrictly, "check-strictly": __props.checkStrictly,
"collapse-transition": __props.collapseTransition, "collapse-transition": __props.collapseTransition,
"only-icon-control": __props.onlyIconControl, "only-icon-control": __props.onlyIconControl,
onNodeClick: handleClick onNodeClick: handleClick,
hideicon: props.hideicon
}, createSlots({ _: 2 }, [ }, createSlots({ _: 2 }, [
_ctx.$slots.title ? { _ctx.$slots.title ? {
name: "title", name: "title",
@ -18045,7 +18052,7 @@ const _sfc_main$J = defineComponent({
]), ]),
key: "0" key: "0"
} : void 0 } : void 0
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control"]) ]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control", "hideicon"])
], 2); ], 2);
}; };
} }

View File

@ -197,7 +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" :hideicon="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

@ -145,7 +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" :hideicon="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>

File diff suppressed because one or more lines are too long