Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 node.setAttrs({label:{text:''}}) 不起作用 #3955

Closed
worthworld opened this issue Oct 7, 2023 · 5 comments
Closed

使用 node.setAttrs({label:{text:''}}) 不起作用 #3955

worthworld opened this issue Oct 7, 2023 · 5 comments
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems

Comments

@worthworld
Copy link

worthworld commented Oct 7, 2023

Describe the bug

x6版本2.15.1初始化渲染数据,当节点值为 {label:{text:''}} 时显示 -
使用 node.setAttrs({label:{text:''}}) 不起作用

Your Example Website or App

https://codesandbox.io/s/html-css-js-t245jd?file=/src/index.js
//

Steps to Reproduce the Bug or Issue

1、节点部分数据 {label:{text:''}} ,使用graph.fromJson渲染节点
2、使用 node.setAttrs({label:{text:''}}) 修改label的值

Expected behavior

作为用户,我希望fromJson渲染节点正常显示label值为空字符串的情况、node.setAttrs({label:{text:''}}) 生效把label的值置为空;但我看到的是fromJson渲染节点空字符串时为'-',node.setAttrs({label:{text:''}}) 时不生效

Screenshots or Videos

No response

Platform

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

Additional context

注: 不一定是label元素,其它具有text属性的元素也存在上述问题

@worthworld
Copy link
Author

node.setAttrs( {label:{ text:0 }} ) 也不起作用

@NewByVector
Copy link
Contributor

我本地试了一下是好的呀,你的测试 demo 发一下?

@NewByVector NewByVector added the resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems label Oct 11, 2023
@worthworld
Copy link
Author

我本地试了一下是好的呀,你的测试 demo 发一下?
嗯,写了一个简单的,你看看; 版本 2.15.x
https://codesandbox.io/s/html-css-js-t245jd?file=/src/index.js

@worthworld
Copy link
Author

Describe the bug

x6版本2.15.1初始化渲染数据,当节点值为 {label:{text:''}} 时显示 - 使用 node.setAttrs({label:{text:''}}) 不起作用

Your Example Website or App

https://codesandbox.io/s/html-css-js-t245jd?file=/src/index.js //

Steps to Reproduce the Bug or Issue

1、节点部分数据 {label:{text:''}} ,使用graph.fromJson渲染节点 2、使用 node.setAttrs({label:{text:''}}) 修改label的值

Expected behavior

作为用户,我希望fromJson渲染节点正常显示label值为空字符串的情况、node.setAttrs({label:{text:''}}) 生效把label的值置为空;但我看到的是fromJson渲染节点空字符串时为'-',node.setAttrs({label:{text:''}}) 时不生效

Screenshots or Videos

No response

Platform

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

Additional context

注: 不一定是label元素,其它具有text属性的元素也存在上述问题

@worthworld
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems
Projects
None yet
Development

No branches or pull requests

2 participants