echarts接入數據后默認高亮不起作用
// 數據更新 -> 圖表重新渲染 -> 默認高亮 // 重新渲染需要時間
1 this.$nextTick(() => { 2 const chart = this.$refs["chartContainer"].chart; 3 if (chart) { 4 chart.dispatchAction({ 5 type: "highlight", 6 seriesIndex: 0, 7 dataIndex: 0 8 }); 9 } 10 });
這里最主要的是要加this.$nextTick,因為加載數據需要時間,圖標重新渲染需要時間。