vue echarts There is a chart instance already initialized on the dom

vue3 使用 echarts 的页面切换路由再切换回来时会出现错误

 

 

  echarts 版本为

 

 

 

之前在 vue2 中用 echarts 版本 5.1.2 并不存在这个问题

 

解决办法:

在 beforeUnmount() 钩子中销毁 echarts instance

 

posted @ 2022-06-01 17:25  laoq112  阅读(566)  评论(0编辑  收藏  举报