Skip to content

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

Closed

Description

@worthworld

问题描述

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

重现链接

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

重现步骤

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

预期行为

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

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本: [2.15.1]

屏幕截图或视频(可选)

No response

补充说明(可选)

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

Activity

  1. added
    oscpThis issue is related to the OSCP (Open Source Contribution Plan)
    on Sep 9, 2025
  2. github-actions commented on Sep 9, 2025

    @github-actions

    🧑🏻‍💻 In order to ensure the better, healthy, and sustainable development of our open-source project, and to allow develops in the community who are interested in open source to easily get started and contribute, we have included this issue in the oscp program. You can claim it by replying with "claim." During the process, you will receive one-on-one guidance from project members, and after your contribution is merged, you will be eligible for some official activity incentives.

    Reference document:


    🧑🏻‍💻 为了让我们的开源项目能更好的、健康的可持续发展,也让社区对开源感兴趣的同学,能轻轻松松的入门和贡献,我们将这个 issue 纳入到 oscp 计划中,回复「认领」即可认领,过程中能有项目成员的一对一指导,并在合并之后获得官方的一些活动激励。

    参考文档:

  3. added a commit that references this issue on Mar 18, 2026
    d073d3c
  4. added a commit that references this issue on Mar 18, 2026
    e348a94
  5. added 2 commits that reference this issue on Oct 15, 2026
    bccd875
    bf13151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    oscpThis issue is related to the OSCP (Open Source Contribution Plan)type: bug 缺陷Defects and unexpected behaviors

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions