antvis/G6

【V5】 自定义节点,如何获取状态 #5898

ada87 posted onGitHub

Describe the bug / 问题描述

在先前的 【beta版本】里面,我是这样获取的:

class CustomNode extends Extensions.BaseNode {
  fn(){
      const state = this.graph.getItemState(id, STATE_NAME);
  }
}

现在到正式V5.0.1版本了,确找不到相关的功能了

需要在 getKeyStyle(attrs: Required<BaseNodeStyleProps>) 这个方法里面根据不同状态返回样式如何办

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response


元素中可以通过 this.attributes.context.graph 访问 Graph 实例 API:getElementState

posted by Aarebecca 10 months ago

Fund this Issue

$0.00
Funded

Pull requests