DON'T use ref or reactive to wrap the echarts instance. Use a common variable or shallowRef to avoid the deep watch for echarts instance.
不要使用 ref 或 reactive 来包装 echarts 实例。使用公共变量或 shallowRef 来避免对 echarts 实例的深度监视。
<template>
<div ref='refMain' ></div>
</template>
import { shallowRef, onMounted } from 'vue';
const myChart = shallowRef();
const refMain = ref(null);
onMounted(() => {
// 获取图表容器的 DOM 元素
const chartDom = refMain.value;
// 初始化
myChart.value = echarts.init(chartDom);
});
标签:TypeError,const,undefined,read,onMounted,chartDom,shallowRef,ref,echarts
From: https://www.cnblogs.com/zhengzhijian/p/17724047.html