no message

This commit is contained in:
KuroSago 2025-05-12 15:03:44 +08:00
parent 52395c43ff
commit 1db799b52c
2 changed files with 29 additions and 17 deletions

View File

@ -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>

View File

@ -139,7 +139,6 @@ function defineStoreImplementation() {
}
return {
// mindMapInstance,
mindMapData,
activeNodes,
currentLayout,