no message
This commit is contained in:
parent
52395c43ff
commit
1db799b52c
@ -1,30 +1,43 @@
|
||||
<template>
|
||||
<div class="h-screen p-6 bg-gradient-to-br from-gray-50 to-gray-100">
|
||||
<MindMap
|
||||
@onDel="onDel"
|
||||
@onAddChild="onAddChild"
|
||||
@onEdit="onEdit"
|
||||
/>
|
||||
<MindMap @onDel="onDel" @onAddChild="onAddChild" @onEdit="onEdit" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted } from "vue";
|
||||
import { MindMap } from "@mind-map/component";
|
||||
import { MindMap, useMindMapStore } from "@mind-map/component";
|
||||
import type { MindMapNode } from "@mind-map/component";
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
console.log("Home view mounted");
|
||||
});
|
||||
|
||||
function onDel (node : MindMapNode) {
|
||||
console.log("Node deleted:", node);
|
||||
};
|
||||
function onAddChild (node : MindMapNode) {
|
||||
console.log("Child node added:", node);
|
||||
};
|
||||
function onEdit (node : MindMapNode) {
|
||||
const { removeNode, insertChildNode } = useMindMapStore();
|
||||
|
||||
function onDel(node: MindMapNode) {
|
||||
removeNode({
|
||||
beforeRemoveCallback: async () => {
|
||||
return true;
|
||||
},
|
||||
nodeId: node.uid,
|
||||
allowRemoveWithChildren: false,
|
||||
});
|
||||
}
|
||||
|
||||
function onAddChild(node: MindMapNode) {
|
||||
insertChildNode({
|
||||
parentNodeId: node.uid,
|
||||
beforeInsertCallback: async () => {
|
||||
return {
|
||||
uid: "node.uid",
|
||||
text: "node.text",
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function onEdit(node: MindMapNode) {
|
||||
console.log("Node edited:", node);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -72,7 +72,7 @@ function defineStoreImplementation() {
|
||||
createNewNodeBehavior: "activeOnly", // 插入新节点的行为 // activeOnly - 只新建激活不编辑
|
||||
|
||||
isUseCustomNodeContent: true, // 是否使用自定义节点内容
|
||||
|
||||
|
||||
addCustomContentToNode: getCustomNodeContent({
|
||||
allowRemoveWithChildren: false,
|
||||
del: (node: MindMapNode) => {
|
||||
@ -139,7 +139,6 @@ function defineStoreImplementation() {
|
||||
}
|
||||
|
||||
return {
|
||||
// mindMapInstance,
|
||||
mindMapData,
|
||||
activeNodes,
|
||||
currentLayout,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user