实现方法
1.参照案例搭建框架
参考链接:https://github.com/keman5/welabx-g6
2.造轮子
1.自定义节点
实现代码:
G6.registerNode(
"card-node",
{
drawShape: function drawShape(cfg, group) {
const shape = group.addShape("rect", {
attrs: {
x: 0,
y: 0,
width: 80,
height: 80,
},
// must be assigned in G6 3.3 and later versions. it can be any string you want, but should be unique in a custom item type
name: "main-box",
draggable: true,
});
// left icon
group.addShape("image", {
attrs: {
x: 0,
y: 0,
height: 80,
width: 80,
img: cfg.img,
},
// must be assigned in G6 3.3 and later versions. it can be any string you want, but should be unique in a custom item type
name: "node-icon",
});
group.addShape("rect", {
attrs: {
x