[Bug] echarts的tooltip渲染模式为html的时候,在切换页面后,鼠标移动至该echarts偶尔会导致tooltip被带到其他页面,且除刷新页面以外无法消失
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### Version
5.5.0
### Link to Minimal Reproduction
none
### Steps to Reproduce
import * as echarts from 'echarts';
import { setTooltipDom } from './index';
export const drawLine = (
dom: HTMLElement,
lineData: {
[key: number]: number | string;
}
) => {
let data = [];
Object.keys(lineData).forEach((name) => {
data.push({
name,
value: lineData[name],
});
});
dom.style.height = data.length * 210 + 'px';
const chart = echarts.init(dom);
let xArr = [];
let yArr = [];
let gridArr = [];
let seriesArr = [];
data.forEach((item, index) => {
xArr.push({
type: 'category',
gridIndex: index,
axisTick: false,
axisLabel: {
color: '#C5D8FF',
},
axisLine: {
lineStyle: {
color: 'rgba(197, 216, 255, 1)',
},
},
data: Object.keys(item.value),
});
yArr.push({
type: 'value',
gridIndex: index,
axisLabel: {
color: 'rgba(197, 216, 255, 1)',
},
splitLine: {
lineStyle: {
type: 'dashed',
color: '#E6F7FF33',
},
},
});
gridArr.push({
id: index,
height: 150,
top: 200 * index + 50,
});
seriesArr.push({
type: 'line',
name: item.name,
data: Object.values(item.value),
xAxisIndex: index,
yAxisIndex: index,
backgroundColor: 'rgb(25, 50, 92)',
});
});
let option = {
xAxis: xArr,
yAxis: yArr,
grid: gridArr,
series: seriesArr,
legend: {
show: true,
textStyle: {
color: 'rgba(197, 216, 255, 1)',
},
left: 30,
top: 10,
itemStyle: {},
},
tooltip: {
confine: false,
appendToBody: true,
trigger: 'axis',
axisPointer: {
type: 'line',
axis: 'x',
},
renderMode: 'html',
className: 'geometryTooltip',
padding: 0,
borderWidth: 0,
formatter: (val) => {
return setTooltipDom(val);
},
},
axisPointer: {
link: [
{
xAxisIndex: 'all',
},
],
},
};
chart.setOption(option);
};

### Current Behavior
tooltip没有消失
### Expected Behavior
希望切换页面后tooltip消失
### Environment
```markdown
- OS:windows11
- Browser: 130.0.6723.117
- Framework:Vue@3.4.25
```
### Any additional comments?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.