antvis/G6


The issue has been closed
v4.8.10 如何部分更新自定义的Node的文字shape #6079
CoolRice posted onGitHub
Describe the bug / 问题描述
现在自定义节点,update好像会整个全部刷新,有什么办法能只更新一个里面的text shape?我看到官网有下面这种写法,但是不适合我,我的自定义节点里有if判断,顺序是不固定的
update(cfg, node) { const group = node.getContainer(); // 获取容器 const shape = group.get('children')[0]; // 按照添加的顺序 const style = { path: this.getPath(cfg), stroke: cfg.color, }; shape.attr(style); // 更新属性 // 更新文本的逻辑类似,但是需要考虑 cfg.label 是否存在的问题 // 通过 label.attr() 更新文本属性即可 },
Reproduction link / 重现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
No response
G6 Version / G6 版本
4.x
Operating System / 操作系统
macOS, Windows
Browser / 浏览器
Chrome
Additional context / 补充说明
No response