1. 程式人生 > 其它 >小程式tab切換上一個echart中的tooltip隱藏不了

小程式tab切換上一個echart中的tooltip隱藏不了

切換事假中清除echart

  checkNav(e){
    this.setData({
      activeIndex: e.currentTarget.dataset.index,
      activeName: e.currentTarget.dataset.navname,
    })
    tab1Echart.dispatchAction({
      type: 'updateAxisPointer',
      currTrigger: 'leave'
   })
    this.getNewRevenue()
  },

echarts程式碼

import * as echarts from '../../../ec-canvas/echarts';
let tab1Echart 
= null function lineOption(tab1Xdata, y1Data, y2Data,y3Data){ let option = { title: { text: tab1Xdata.length==0?'暫無資料':'', x: 'center' , y: 'center' , textStyle: { color: '#bcbcbc', fontWeight: 600, fontSize: 16 } }, legend: { selectedMode:
false, // data: [tab1Line1Name, tab1Line2Name], top: '2%', left: 'left', backgroundColor: '#fff', z: 100, }, grid: { left: '3%',right: '3%',top: '20%',bottom: '3%', containLabel: true }, tooltip: { show: true, trigger: 'shadow', axisPointer:{ shadowStyle:{ color:
'rgba(150,150,150,0.3)' } } }, xAxis: { type: 'category', boundaryGap: false, data: tab1Xdata, }, yAxis: { type: 'value', x: 'center', splitLine: { lineStyle: { type: 'dashed' } }, }, series: [] }; return option } let xData = [], onedata = [],twodata = [], beonline = [] function initChart(canvas, width, height) { tab1Echart = echarts.init(canvas, null, { width: width, height: height }); canvas.setChart(tab1Echart); // tab1Echart.showLoading({ // text: 'loading', // color: '#c23531', // textColor: '#000', // maskColor: 'rgba(255, 255, 255, 0.2)', // zlevel: 0, // }); var option = lineOption(xData, onedata, twodata, beonline) tab1Echart.setOption(option); return tab1Echart; }