parent
bbf1cc8a6f
commit
8f77208806
|
@ -119,7 +119,10 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
const instance = getCurrentInstance();
|
const instance = getCurrentInstance();
|
||||||
const eventData = computed(() => {
|
const eventData = computed(() => {
|
||||||
return convertNodePropsToEventData(props);
|
const { eventKey } = props;
|
||||||
|
const { keyEntities } = context.value;
|
||||||
|
const { parent } = keyEntities[eventKey] || {};
|
||||||
|
return { ...convertNodePropsToEventData(props), parent };
|
||||||
});
|
});
|
||||||
const dragNodeEvent: DragNodeEvent = reactive({
|
const dragNodeEvent: DragNodeEvent = reactive({
|
||||||
eventData,
|
eventData,
|
||||||
|
|
|
@ -34,6 +34,7 @@ export interface EventDataNode extends DataNode {
|
||||||
pos?: string;
|
pos?: string;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
dataRef?: DataNode;
|
dataRef?: DataNode;
|
||||||
|
parent?: DataNode;
|
||||||
eventKey?: Key; // 兼容 v2, 推荐直接用 key
|
eventKey?: Key; // 兼容 v2, 推荐直接用 key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@ export const treeNodeProps = {
|
||||||
|
|
||||||
/** New added in Tree for easy data access */
|
/** New added in Tree for easy data access */
|
||||||
data: { type: Object as PropType<DataNode>, default: undefined as DataNode },
|
data: { type: Object as PropType<DataNode>, default: undefined as DataNode },
|
||||||
|
parent: { type: Object as PropType<DataNode>, default: undefined as DataNode },
|
||||||
|
|
||||||
isStart: { type: Array as PropType<boolean[]> },
|
isStart: { type: Array as PropType<boolean[]> },
|
||||||
isEnd: { type: Array as PropType<boolean[]> },
|
isEnd: { type: Array as PropType<boolean[]> },
|
||||||
active: { type: Boolean, default: undefined },
|
active: { type: Boolean, default: undefined },
|
||||||
|
|
|
@ -375,7 +375,7 @@ export function getTreeNodeProps(
|
||||||
checked: checkedKeys.indexOf(key) !== -1,
|
checked: checkedKeys.indexOf(key) !== -1,
|
||||||
halfChecked: halfCheckedKeys.indexOf(key) !== -1,
|
halfChecked: halfCheckedKeys.indexOf(key) !== -1,
|
||||||
pos: String(entity ? entity.pos : ''),
|
pos: String(entity ? entity.pos : ''),
|
||||||
|
parent: entity.parent,
|
||||||
// [Legacy] Drag props
|
// [Legacy] Drag props
|
||||||
// Since the interaction of drag is changed, the semantic of the props are
|
// Since the interaction of drag is changed, the semantic of the props are
|
||||||
// not accuracy, I think it should be finally removed
|
// not accuracy, I think it should be finally removed
|
||||||
|
|
Loading…
Reference in New Issue