File tree 4 files changed +8
-2
lines changed
4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,10 @@ export default defineComponent({
119
119
} ) ;
120
120
const instance = getCurrentInstance ( ) ;
121
121
const eventData = computed ( ( ) => {
122
- return convertNodePropsToEventData ( props ) ;
122
+ const { eventKey } = props ;
123
+ const { keyEntities } = context . value ;
124
+ const { parent } = keyEntities [ eventKey ] || { } ;
125
+ return { ...convertNodePropsToEventData ( props ) , parent } ;
123
126
} ) ;
124
127
const dragNodeEvent : DragNodeEvent = reactive ( {
125
128
eventData,
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ export interface EventDataNode extends DataNode {
34
34
pos ?: string ;
35
35
active ?: boolean ;
36
36
dataRef ?: DataNode ;
37
+ parent ?: DataNode ;
37
38
eventKey ?: Key ; // 兼容 v2, 推荐直接用 key
38
39
}
39
40
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ export const treeNodeProps = {
45
45
46
46
/** New added in Tree for easy data access */
47
47
data : { type : Object as PropType < DataNode > , default : undefined as DataNode } ,
48
+ parent : { type : Object as PropType < DataNode > , default : undefined as DataNode } ,
49
+
48
50
isStart : { type : Array as PropType < boolean [ ] > } ,
49
51
isEnd : { type : Array as PropType < boolean [ ] > } ,
50
52
active : { type : Boolean , default : undefined } ,
Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ export function getTreeNodeProps(
375
375
checked : checkedKeys . indexOf ( key ) !== - 1 ,
376
376
halfChecked : halfCheckedKeys . indexOf ( key ) !== - 1 ,
377
377
pos : String ( entity ? entity . pos : '' ) ,
378
-
378
+ parent : entity . parent ,
379
379
// [Legacy] Drag props
380
380
// Since the interaction of drag is changed, the semantic of the props are
381
381
// not accuracy, I think it should be finally removed
You can’t perform that action at this time.
0 commit comments