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 | <script lang="tsx"> | 1 | <script lang="tsx"> |
2 | import type { ReplaceFields, Keys, CheckKeys, TreeActionType, TreeItem } from './types'; | 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 | import { Tree } from 'ant-design-vue'; | 14 | import { Tree } from 'ant-design-vue'; |
6 | import { TreeIcon } from './TreeIcon'; | 15 | import { TreeIcon } from './TreeIcon'; |
7 | // import { DownOutlined } from '@ant-design/icons-vue'; | 16 | // import { DownOutlined } from '@ant-design/icons-vue'; |
@@ -77,9 +86,8 @@ | @@ -77,9 +86,8 @@ | ||
77 | state.selectedKeys = v; | 86 | state.selectedKeys = v; |
78 | emit('update:selectedKeys', v); | 87 | emit('update:selectedKeys', v); |
79 | }, | 88 | }, |
80 | - onCheck: (v: CheckKeys, e) => { | 89 | + onCheck: (v: CheckKeys) => { |
81 | state.checkedKeys = v; | 90 | state.checkedKeys = v; |
82 | - console.log(e); | ||
83 | emit('update:value', v); | 91 | emit('update:value', v); |
84 | }, | 92 | }, |
85 | onRightClick: handleRightClick, | 93 | onRightClick: handleRightClick, |
@@ -128,7 +136,7 @@ | @@ -128,7 +136,7 @@ | ||
128 | const propsData = omit(item, 'title'); | 136 | const propsData = omit(item, 'title'); |
129 | const icon = getIcon({ ...item, level }, item.icon); | 137 | const icon = getIcon({ ...item, level }, item.icon); |
130 | return ( | 138 | return ( |
131 | - <Tree.TreeNode {...propsData} key={get(item, keyField)}> | 139 | + <Tree.TreeNode {...propsData} node={toRaw(item)} key={get(item, keyField)}> |
132 | {{ | 140 | {{ |
133 | title: () => ( | 141 | title: () => ( |
134 | <span class={`${prefixCls}-title`}> | 142 | <span class={`${prefixCls}-title`}> |