提交 b6bb8163 作者: Vben

fix: expose tree information in the event close #315

上级 72b42d7b
<script lang="tsx"> <script lang="tsx">
import type { ReplaceFields, Keys, CheckKeys, TreeActionType, TreeItem } from './types'; import type { ReplaceFields, Keys, CheckKeys, TreeActionType, TreeItem } from './types';
import { defineComponent, reactive, computed, unref, ref, watchEffect, onMounted } from 'vue'; import {
defineComponent,
reactive,
computed,
unref,
ref,
watchEffect,
onMounted,
toRaw,
} from 'vue';
import { Tree } from 'ant-design-vue'; import { Tree } from 'ant-design-vue';
import { TreeIcon } from './TreeIcon'; import { TreeIcon } from './TreeIcon';
// import { DownOutlined } from '@ant-design/icons-vue'; // import { DownOutlined } from '@ant-design/icons-vue';
...@@ -77,9 +86,8 @@ ...@@ -77,9 +86,8 @@
state.selectedKeys = v; state.selectedKeys = v;
emit('update:selectedKeys', v); emit('update:selectedKeys', v);
}, },
onCheck: (v: CheckKeys, e) => { onCheck: (v: CheckKeys) => {
state.checkedKeys = v; state.checkedKeys = v;
console.log(e);
emit('update:value', v); emit('update:value', v);
}, },
onRightClick: handleRightClick, onRightClick: handleRightClick,
...@@ -128,7 +136,7 @@ ...@@ -128,7 +136,7 @@
const propsData = omit(item, 'title'); const propsData = omit(item, 'title');
const icon = getIcon({ ...item, level }, item.icon); const icon = getIcon({ ...item, level }, item.icon);
return ( return (
<Tree.TreeNode {...propsData} key={get(item, keyField)}> <Tree.TreeNode {...propsData} node={toRaw(item)} key={get(item, keyField)}>
{{ {{
title: () => ( title: () => (
<span class={`${prefixCls}-title`}> <span class={`${prefixCls}-title`}>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论