1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| import { deepClone } from '/@/utils/other';
| import { useNode, useVueFlow } from '@vue-flow/core';
| const { removeNodes, nodes, addNodes } = useVueFlow();
|
| export const useNodeOpt = (node:any) => {
|
| function handleClickDuplicateBtn() {
| const { type, position, data } = node.node;
| const newNode = {
| id: (nodes.value.length + 1).toString(),
| type,
| position: {
| x: position.x + 100,
| y: position.y + 100,
| },
| data: deepClone(data),
| };
| addNodes(newNode);
| }
| const clickDeleteBtn = () => {
| removeNodes(node.id);
| };
|
| return {
| handleClickDuplicateBtn,
| clickDeleteBtn,
| };
| };
|
|