G6 icon indicating copy to clipboard operation
G6 copied to clipboard

自定义dom节点报错,按照官网API例子写的

Open atuosizhanshen opened this issue 2 years ago • 1 comments

Describe the bug

报错信息如下 TypeError: ShapeBase[shapeType] is not a constructor at Container.addShape (container.js?330d:203:1)

我是这么注册使用 G6.registerNode( 'dom-node', { draw: (cfg, group) => { return group.addShape('dom', { ...

Your Example Website or App

null

Steps to Reproduce the Bug or Issue

页面直接加载

Expected behavior

页面加载时

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

atuosizhanshen avatar Sep 06 '22 08:09 atuosizhanshen

实例化图的时候,是不是没配置 renderer: 'svg'?

Yanyan-Wang avatar Sep 07 '22 08:09 Yanyan-Wang

尊敬的用户,您好。我们很重视您的 issue,但由于长时间没有答复,我们暂时认为这个问题已经解决。如果还有任何问题,请随时根据 issue 模版再开启新的 issue。

Yanyan-Wang avatar Nov 04 '22 07:11 Yanyan-Wang

https://antv-g6.gitee.io/zh/docs/manual/middle/elements/nodes/custom-node#5-%E4%BD%BF%E7%94%A8-dom-%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8A%82%E7%82%B9 官网的例子copy下来完全跑不起来,就是报上面这个错,其他地方又看不到例子,百度谷歌更是搜不到类似报错原因,直接劝退啊。 官网中的edges: [(source: 'node1'), (target: 'node2')]是上个什么东西...

bendajun avatar Nov 22 '22 08:11 bendajun

上面报错的原因就是 renderer 没有指定为 'svg',是文档里面的代码片段确实的锅

[(source: 'node1'), (target: 'node2')]

这个也写错了 [{ source: 'node1', target: 'node2' }]

感谢指出,上面两个问题会尽快更新

Yanyan-Wang avatar Nov 22 '22 09:11 Yanyan-Wang