antvis / G6

♾ A Graph Visualization Framework in JavaScript.
https://g6.antv.antgroup.com/
MIT License
11.17k stars 1.33k forks source link

graph.updateNodeData #6474

Closed HHH-bot-code closed 1 week ago

HHH-bot-code commented 3 weeks ago

Describe the bug / 问题描述

The updateNodeData in the website example does not take effect without using updateNodeData in local vue projects

Reproduction link / 重现链接

https://g6.antv.antgroup.com/examples/behavior/inner-event/#basic

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

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response

HHH-bot-code commented 3 weeks ago

The updateNodeData in the website example does not effect local vue project have effect

Aarebecca commented 3 weeks ago

Could you please provide more details about your problem

HHH-bot-code commented 2 weeks ago

Could you please provide more details about your problem Click no effect image

Aarebecca commented 1 week ago

There is a bug in the example, you can refer to the following code modification, we will fix it as soon as possible:

graph.on(NodeEvent.CLICK, (event) => {
  const { target, originalTarget } = event;
  console.log('click', originalTarget);
  if (originalTarget.className === 'light') { // use className
    graph.updateNodeData([{ id: target.id, states: ['selected'], style: { labelText: 'Clicked!' } }]);
    graph.draw();
  }
});