antvis / X6

🚀 JavaScript diagramming library that uses SVG and HTML for rendering.
https://x6.antv.antgroup.com
MIT License
5.71k stars 1.7k forks source link

关于vue组件作为node节点,使用graph.removeNode报错nextSibling为null #3924

Open TyCoding opened 1 year ago

TyCoding commented 1 year ago

Describe the bug

这个Bug是不是很早之前就有了?

现象:

自定义Vue节点内容如下: image

Graph定义如下:

graph.on('node:click', ({ node }) => {
    graph.removeNode(node)
  });

报错如下: image

解决办法

Vue节点必须只存在一个根节点时,删除Node才不报错,即使是注释行也不能存在 image

Your Example Website or App

1

Steps to Reproduce the Bug or Issue

1

Expected behavior

1

Screenshots or Videos

1

Platform

Additional context

1

tianye19941001 commented 1 year ago

也遇到了,果然,感恩

NewByVector commented 1 year ago

有没有 vue 大神来修复一下。

lloydzhou commented 1 year ago

这个和x6没有关系,是vue自身的问题:vue这边要求每一个组件的template内部只有一个root element

如果使用vue3,也尽量使用Fragment 显示的封装一层,不建议直接写多个根元素。

aimilu commented 3 months ago

感谢,果然代码里留了个注释行导致报错的,真是长见识了