Commit b6bb81630de728c146bf0e559bef88b69d4b8a21
1 parent
72b42d7b
fix: expose tree information in the event close #315
Showing
1 changed file
with
12 additions
and
4 deletions
src/components/Tree/src/index.vue
1 | 1 | <script lang="tsx"> |
2 | 2 | import type { ReplaceFields, Keys, CheckKeys, TreeActionType, TreeItem } from './types'; |
3 | 3 | |
4 | - import { defineComponent, reactive, computed, unref, ref, watchEffect, onMounted } from 'vue'; | |
4 | + import { | |
5 | + defineComponent, | |
6 | + reactive, | |
7 | + computed, | |
8 | + unref, | |
9 | + ref, | |
10 | + watchEffect, | |
11 | + onMounted, | |
12 | + toRaw, | |
13 | + } from 'vue'; | |
5 | 14 | import { Tree } from 'ant-design-vue'; |
6 | 15 | import { TreeIcon } from './TreeIcon'; |
7 | 16 | // import { DownOutlined } from '@ant-design/icons-vue'; |
... | ... | @@ -77,9 +86,8 @@ |
77 | 86 | state.selectedKeys = v; |
78 | 87 | emit('update:selectedKeys', v); |
79 | 88 | }, |
80 | - onCheck: (v: CheckKeys, e) => { | |
89 | + onCheck: (v: CheckKeys) => { | |
81 | 90 | state.checkedKeys = v; |
82 | - console.log(e); | |
83 | 91 | emit('update:value', v); |
84 | 92 | }, |
85 | 93 | onRightClick: handleRightClick, |
... | ... | @@ -128,7 +136,7 @@ |
128 | 136 | const propsData = omit(item, 'title'); |
129 | 137 | const icon = getIcon({ ...item, level }, item.icon); |
130 | 138 | return ( |
131 | - <Tree.TreeNode {...propsData} key={get(item, keyField)}> | |
139 | + <Tree.TreeNode {...propsData} node={toRaw(item)} key={get(item, keyField)}> | |
132 | 140 | {{ |
133 | 141 | title: () => ( |
134 | 142 | <span class={`${prefixCls}-title`}> | ... | ... |