diff --git a/src/components/Tree/src/index.vue b/src/components/Tree/src/index.vue index 9d379a8d2492c038f824b84ba692a34a1435f2c5..d21d7ff89fc34e5f2875864ca0ea4fd9d03c2bdd 100644 --- a/src/components/Tree/src/index.vue +++ b/src/components/Tree/src/index.vue @@ -30,6 +30,8 @@ import { basicProps } from './props'; import { CreateContextOptions } from '/@/components/ContextMenu'; + import { CheckEvent } from './types'; + interface State { expandedKeys: Keys; selectedKeys: Keys; @@ -87,11 +89,11 @@ state.selectedKeys = v; emit('update:selectedKeys', v); }, - onCheck: (v: CheckKeys) => { + onCheck: (v: CheckKeys, e: CheckEvent) => { state.checkedKeys = v; const rawVal = toRaw(v); emit('update:value', rawVal); - emit('check', rawVal); + emit('check', rawVal, e); }, onRightClick: handleRightClick, }; diff --git a/src/components/Tree/src/types.ts b/src/components/Tree/src/types.ts index 4183f204934dd3f4910325b5cbeccff3baf6c263..a847e6f4fa6864466f969bcacfb4a3147e0bf401 100644 --- a/src/components/Tree/src/types.ts +++ b/src/components/Tree/src/types.ts @@ -1,4 +1,4 @@ -import type { TreeDataItem } from 'ant-design-vue/es/tree/Tree'; +import type { TreeDataItem, CheckEvent as CheckEventOrigin } from 'ant-design-vue/es/tree/Tree'; import { ContextMenuItem } from '/@/hooks/web/useContextMenu'; export interface ActionItem { render: (record: Recordable) => any; @@ -47,3 +47,5 @@ export interface ContextMenuOptions { styles?: any; items?: ContextMenuItem[]; } + +export type CheckEvent = CheckEventOrigin; diff --git a/src/views/demo/tree/index.vue b/src/views/demo/tree/index.vue index e82f8323cc54e8747d13bc3450c1746bc3f438a3..c6ecea626a3aaa90fc32dc8b89b7cc6e0070775a 100644 --- a/src/views/demo/tree/index.vue +++ b/src/views/demo/tree/index.vue @@ -3,7 +3,13 @@
- +