This commit is contained in:
神仙都没用 2023-11-24 15:22:29 +08:00
parent 0f440cae4c
commit 561b6a670d
2 changed files with 5 additions and 2 deletions

View File

@ -36,9 +36,10 @@
:props="tree.props" :props="tree.props"
:load="tree.onLoad" :load="tree.onLoad"
:default-expanded-keys="tree.defaultExpandedKeys" :default-expanded-keys="tree.defaultExpandedKeys"
@node-click="select"
> >
<template #default="{ data }"> <template #default="{ data }">
<div class="item" @click="select(data)"> <div class="item">
<component :is="data.icon" v-if="data.icon" /> <component :is="data.icon" v-if="data.icon" />
<span>{{ data[tree.props.label] }}</span> <span>{{ data[tree.props.label] }}</span>
</div> </div>
@ -508,6 +509,7 @@ defineExpose({
display: flex; display: flex;
align-items: center; align-items: center;
line-height: 1; line-height: 1;
height: 100%;
width: 100%; width: 100%;
} }
} }

View File

@ -33,6 +33,7 @@
v-loading="loading" v-loading="loading"
node-key="id" node-key="id"
default-expand-all default-expand-all
highlight-current
:data="list" :data="list"
:props="{ :props="{
label: 'name' label: 'name'
@ -42,6 +43,7 @@
:allow-drop="allowDrop" :allow-drop="allowDrop"
:expand-on-click-node="false" :expand-on-click-node="false"
@node-contextmenu="onContextMenu" @node-contextmenu="onContextMenu"
@node-click="rowClick"
> >
<template #default="{ node, data }"> <template #default="{ node, data }">
<div class="dept-tree__node"> <div class="dept-tree__node">
@ -50,7 +52,6 @@
:class="{ :class="{
'is-active': data.id == ViewGroup?.selected?.id 'is-active': data.id == ViewGroup?.selected?.id
}" }"
@click="rowClick(data)"
>{{ node.label }}</span >{{ node.label }}</span
> >
<span <span