首页 前端知识 [ECharts] There is a chart instance already initialized on the dom.问题原因

[ECharts] There is a chart instance already initialized on the dom.问题原因

2024-09-09 00:09:49 前端知识 前端哥 898 656 我要收藏

在使用vue绘图的时候,我设置间隔时间进行绘制,控制台一直警告 [ECharts] There is a chart instance already initialized on the dom.
查看代码是因为获取了两次dom进行了初始化

mounted() {
this.mychart = echarts.init(this.$refs.charts);//此处和下边的initChart方法里重复了
//实时获取,离开销毁
let currentTimer = setInterval(() => {
console.log(this.maxList)
this.getByIdMax();
}, 1000);
this.$once("hook:beforeDestroy", () => {
clearInterval(currentTimer);
currentTimer = null;
console.log("高温预警卡片销毁了");
});
},
methods: {
//图表初始化
initChart() {
//初始化echarts实例(与上方重复获取dom导致出错,删掉即可)
let lineCharts = echarts.init(this.$refs.charts);
复制
转载请注明出处或者链接地址:https://www.qianduange.cn//article/18002.html
标签
评论
还可以输入200
共0条数据,当前/页
发布的文章

安装Nodejs后,npm无法使用

2024-11-30 11:11:38

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!