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

Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. #6349

Open
sunsou1 opened this issue Sep 18, 2024 · 4 comments

Comments

@sunsou1
Copy link

sunsou1 commented Sep 18, 2024

Describe the bug / 问题描述

Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

Reproduction link / 重现链接

https://codesandbox.io/p/sandbox/epic-stonebraker-33rrv6?file=%2Findex.js%3A16%2C26

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

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

No response

@resetsix
Copy link

没见过style里有innerHTML属性。

样式对象属性参考文档节点通用样式配置项

@sunsou1
Copy link
Author

sunsou1 commented Sep 18, 2024

image
我看官网上这个node里配置的innerHTML属性。
我如果放到数据里,怎么配置呢?

@sunsou1
Copy link
Author

sunsou1 commented Sep 18, 2024

@resetsix
image
我参考的这个。

@resetsix
Copy link

我如果放到数据里,怎么配置呢?

innerHTML的位置你放错了。

✅正确位置应该是:

const graph = new Graph({
  container: xxx,
  data:xxx,
  node: {
    type: xxx,
    size: xxx,
    style: {
      innerHTML
    },
  },
});

❌而你放在了data属性里:

const graph = new Graph({
  container: xxx,
  data:{
    nodes:[innerHTML],
    edges:[],
  },
  node: {
    type: xxx,
    size: xxx,
    style: {
      //...
    },
  },
});

data 数据下的 nodes 和 样式对象 node 区别请阅读文档:


项目报错的原因应该也是因为innerHTML位置不正确导致。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants