G6的自环边设置-Loop

1
2
3
4
if (item.source == item.target) {
// 自环边的设置,增加loop属性即可
this.$set(item, "type", "loop");
}

参考文档

https://g6.antv.antgroup.com/manual/middle/elements/edges/built-in/loop#%E6%A0%87%E7%AD%BE%E6%96%87%E6%9C%AC%E9%85%8D%E7%BD%AE-labelcfg