点击弹窗调用应该在open中
//父组件用open方式弹出
handleSearch (id) {
this.$refs.orderDetail.open(id)
}
//子组件在open方法中调用
async open (id) {
this.dialogVisible = true;
this.fenleizhanbiChart()
this.getzaodiandingdanliangtongjiChart()
}
用this.$nextTick包一下
this.$nextTick(() => {
// 初始化代码
const chartDom = document.getElementById('Chart');
const myChart = echarts.init(chartDom);
const option = {
...};
myChart.setOption(option);
})
或
this.$nextTick(() => {
// 初始化代码
const myChart = echarts.init(this.$refs.Chart);
const option = {
...};
myChart.setOption(option);
})