G6 icon indicating copy to clipboard operation
G6 copied to clipboard

tooltip.getContent 依赖于异步数据

Open grainnn opened this issue 1 year ago • 1 comments

问题描述

根据文档:

const tooltip = new G6.Tooltip({
  offsetX: 10,
  offsetY: 20,
  getContent(e) {
    const outDiv = document.createElement('div');
    outDiv.style.width = '180px';
    outDiv.innerHTML = `
      <h4>自定义tooltip</h4>
      <ul>
        <li>Label: ${e.item.getModel().label || e.item.getModel().id}</li>
      </ul>`
    return outDiv
  },
  itemTypes: ['node']
});

const graph = new G6.Graph({
  //... 其他配置项
  plugins: [tooltip], // 配置 Tooltip 插件
});

如果getContent中的数据依赖于异步请求的数据(鼠标与node、edge有交互动作后才去拉数据),该如何处理?

目前getContent不支持 声明为async类型:

getContent: async function () {}

重现链接

不需要提供

重现步骤

不需要重现

预期行为

不需要重现

平台

不需要提供

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

grainnn avatar Aug 10 '22 03:08 grainnn

现在不支持哈,可以自定义 DOM 元素,挂载方式详见:https://g6.antv.vision/zh/docs/manual/advanced/coordinate-system

欢迎社区同学共建支持 tooltip 的异步渲染

Yanyan-Wang avatar Aug 10 '22 06:08 Yanyan-Wang

现在不支持哈,可以自定义 DOM 元素,挂载方式详见:https://g6.antv.vision/zh/docs/manual/advanced/coordinate-system

欢迎社区同学共建支持 tooltip 的异步渲染

现在插件也不支持异步获取数据嘛?

jiechuan1221 avatar Jun 07 '23 14:06 jiechuan1221