title: I cant put echartinstance into data In vue 3
body: <p>I am using Vue 3 and Echart. The function was that when options were detected to be changed, the chart will update accordingly.</p>
  <pre><code>&lt;template&gt;
    &lt;div ref=&quot;theChart&quot; :style=&quot;{ height: '400px' }&quot;&gt;&lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script lang=&quot;ts&quot;&gt;
  import { defineComponent } from &quot;vue&quot;;
  import * as echarts from &quot;echarts&quot;;
  import * as _ from &quot;lodash&quot;;
  
  type EChartsOption = echarts.EChartsOption;
  
  export default defineComponent({
    name: &quot;LineChart&quot;,
    components: {},
    props: {
      options: {
        type: Object,
        required: true,
      },
    },
    mounted() {
      this.drawChart(this.options);
    },
    watch: {
      options: {
        handler(newOptions, oldOptions) {
          if (!_.isEqual(oldOptions, newOptions)) {
            console.info(&quot;hello&quot;);
            this.drawChart(newOptions);
          }
        },
        deep: true,
      },
    },
    methods: {
      drawChart(options: EChartsOption) {
        const chartElement = this.$refs.theChart as HTMLElement;
        const chart = echarts.init(chartElement, undefined, {
          renderer: &quot;svg&quot;,
        });
        chart.setOption(options, true);
      },
    },
  });
  &lt;/script&gt;
  </code></pre>
  <p>But I got the following &quot;warning&quot; but it works fine<a href="https://i.stack.imgur.com/cs9ea.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cs9ea.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/rq96J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rq96J.png" alt="Warning" /></a></p>
  <p>Of course, I tried to put this.echartsModule.init(XXXX) into a component data. But I got the following error when I clicked on the legend of the chart <a href="https://github.com/apache/echarts/issues/14198" rel="nofollow noreferrer">https://github.com/apache/echarts/issues/14198</a> That is why I used to put this.echartsModule.init(XXXX) into const as zhenghaiyang said.
  Do you have a better solution to avoid rewrite echartsModule.init(XXXX)? Thanks in advance!</p>