antvis/G6

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Same issue, vue3, G6 4.8.21, tooltip won't go away #6643

zzj9468 posted onGitHub

同样的问题,vue3,G6 4.8.21, tooltip不会消失

ToolTip

tooltip: new G6.Tooltip({ // offsetX: 10, // offsetY: 20, getContent(e) { const outDiv = document.createElement("div"); outDiv.style.maxWidth = "150px"; outDiv.innerHTML = ’e.item.getModel().title‘; return outDiv; }, itemTypes: ["node"], }),

graph

this.graph = new G6.Graph({ container: this.containerId, data: value, layout: { type: "force", preventOverlap: true, nodeSize: 32, unitRadius: 100, linkDistance: 100, }, defaultNode: { labelCfg: { style: { fill: "#fff", fontSize: 12, lineWidth: 0, }, }, }, defaultEdge: { size: 1, style: {}, labelCfg: { label: { label: false, }, }, }, nodeStateStyles: { highlight: { opacity: 0.1, }, }, edgeStateStyles: { highlight: { opacity: 0.1, }, }, plugins: [this.tooltip], modes: { default: ["drag-canvas", "zoom-canvas", "drag-node"], }, });

效果

https://github.com/user-attachments/assets/cfe9b385-6703-4664-a2da-6f20b254fb49

Originally posted by @zzj9468 in https://github.com/antvis/G6/issues/5966#issuecomment-2545229821


const tooltip = document.getElementsByClassName("tooltip")[0]; 你可以通过上面的代码拿到 tooltip 的 dom 节点,然后通过修改样式去控制它的显示与隐藏

posted by zhongyunWan about 2 months ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests