antvis/G6

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() 更新文本属性即可 },

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


没太理解你的需求,请附上可以复现问题的最小案例代码

posted by yvonneyx 9 months ago

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

posted by github-actions[bot] 9 months ago

Fund this Issue

$0.00
Funded

Pull requests