-
import { Addon } from '@antv/x6'
- initShape=(e)=> {
// 拖拽添加节点
const dnd = new Addon.Dnd({
target: this.graph, //目标画布(必传)
animation: true
})
const node= this.graph.createNode({
width: 100,
height: 100,
shape: 'rect',
attrs: {
body: {
fill: '#ccc'
}
}
})
dnd.start(node, e)
}
// 使用
<Button onMouseDown={e => initShape(e)}> node </Button>
流程图拖拽
最新推荐文章于 2025-06-09 17:39:28 发布
该文章介绍了如何在AntVX6图形库中创建一个新的Dnd实例来实现拖拽添加节点的功能。通过设置目标画布、动画效果以及创建具有特定形状和样式的节点,用户可以实现节点的动态添加。
2946

被折叠的 条评论
为什么被折叠?



