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

shape: html不渲染内容,一片空白 #4287

Open
havenothingtosay opened this issue Apr 29, 2024 · 2 comments
Open

shape: html不渲染内容,一片空白 #4287

havenothingtosay opened this issue Apr 29, 2024 · 2 comments

Comments

@havenothingtosay
Copy link

Describe the bug

shape: html类型的节点,不能渲染html内容,一片空白,文档中也没找到使用示例,请提供一下使用文档,或确认是否bug

Your Example Website or App

https://codesandbox.io/p/sandbox/antv-x6-shape-htmlkong-bai-wen-ti-v2gvvv?file=%2Findex.ts%3A23%2C5

Steps to Reproduce the Bug or Issue

graph.addNode({
  shape: "html",
  x: 320,
  y: 260,
  width: 120,
  height: 50,
  html: () => {
    const wrap = document.createElement("div");
    wrap.style.width = "100%";
    wrap.style.height = "100%";
    wrap.style.display = "flex";
    wrap.style.alignItems = "center";
    wrap.style.justifyContent = "center";
    wrap.style.border = "2px solid #9254de";
    wrap.style.background = "#efdbff";
    wrap.style.borderRadius = "4px";
    wrap.innerText = "Hello";
    return wrap;
  },
  attrs: {
    body: {
      fill: "#efdbff",
      stroke: "#9254de",
      rx: 4,
      ry: 4,
    },
  },
});

Expected behavior

能正确显示html内容。如果是我使用错误,麻烦提供文档示例参考

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 2.17.1, vue 3.4.6

Additional context

No response

@XueMeijing
Copy link
Contributor

这里是自定义组件文档 https://x6.antv.antgroup.com/tutorial/intermediate/html

要先注册shape,才能使用

image

@havenothingtosay
Copy link
Author

这里是自定义组件文档 https://x6.antv.antgroup.com/tutorial/intermediate/html

要先注册shape,才能使用

image

我在文档中看见是内置节点,以为可以直接使用,抱歉,理解错误了
image

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