antvis/G6


The issue has been closed
tooltip.getContent 依赖于异步数据 #3850
grainnn posted onGitHub
问题描述
根据文档:
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