子组件:
<template>
<div>
<div id="myChart" :style="echartStyle"></div>
</div>
</template>
echarts init 选择 id选择器元素来初始化了
this.charts = this.$echarts.init(document.getElementById(id));
更改为:
<template>
<div>
<div ref="bar_dv" :style="echartStyle"></div>
</div>
</template>
初始化方式:
this.charts = this.$echarts.init(this.$refs.bar_dv)
详情查看 ref 常见使用场景(个人见解)