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

🐛tooltip挂载节点只在首次渲染时更新,延时修改挂载节点无效 #2146

Closed
2 tasks
Bernicechl opened this issue Apr 3, 2023 · 3 comments
Closed
2 tasks
Assignees
Labels
❔question 疑问/使用问题 s2-core Core 层 问题

Comments

@Bernicechl
Copy link

🏷 Version

官网版本

Package Version
@antv/s2 官网版本
@antv/s2-react
@antv/s2-vue

Sheet Type

  • PivotSheet
  • TableSheet

🖋 Description

场景:表格在全屏、非全屏状态下切换时,需要挂载在不同的DOM节点上才可正常显示。
复现代码现状:
1.首次渲染时tooltip内容为‘hhh’,默认挂在body上
2.延时10s修改tooltip内容为‘aaa’,并修改getContainer容器为'#container'(canvas的父容器)
3.点击单元格,tooltip显示为'hhh',挂在body上
4.10s后点击单元格,tooltip显示为‘aaa’,仍然挂在body而非container上。此处需要挂在container上

🔗 Reproduce Link

复现链接:https://codesandbox.io/s/zealous-ardinghelli-vptd6s?file=/index.ts:0-2329 此处看不到tooltip内容,可将代码拷到demo中查看

🤔 Steps to Reproduce

复现链接看不到tooltip内容,可将代码拷到官网demo中查看

😊 Expected Behavior

挂载节点似乎只在首次渲染时更新,希望达到10s后点击单元格,tooltip显示为‘aaa’,此处需要挂在container上。

😅 Current Behavior

挂载节点未更新,10s后点击单元格,tooltip显示为‘aaa’,仍然挂在body而非container上

@lijinke666 lijinke666 added the s2-core Core 层 问题 label Apr 12, 2023
@lcx-seima lcx-seima added the ❔question 疑问/使用问题 label Apr 23, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2023
@lcx-seima
Copy link
Contributor

改变之前,卸载 之前的 tooltip 就行了

+ s2.tooltip.destroy();

  s2Options.tooltip = {
    showTooltip: true,
    content: () => {
      return "aaa";
    },
    getContainer: () => {
      console.log("getContainer2");
      return document.querySelector("#container");
    }
  };
  s2.setOptions(s2Options);
  s2.render();

@antvis antvis deleted a comment from github-actions bot Apr 23, 2023
@wangwufan
Copy link

改变之前,卸载 之前的 tooltip 就行了

+ s2.tooltip.destroy();

  s2Options.tooltip = {
    showTooltip: true,
    content: () => {
      return "aaa";
    },
    getContainer: () => {
      console.log("getContainer2");
      return document.querySelector("#container");
    }
  };
  s2.setOptions(s2Options);
  s2.render();

我在使用全屏效果时也发现这个问题,直接改tooltip没用,现在知道原来还有这操作,destory之后确实好用了

@Bernicechl
Copy link
Author

Bernicechl commented Dec 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔question 疑问/使用问题 s2-core Core 层 问题
Projects
None yet
Development

No branches or pull requests

4 participants