Vue component rendering failed

problem: I have written a chart component, which cannot be rendered in the parent component. However, after modifying the file in the hot load, it will be rendered. After refreshing, the browser console has not reported any errors, and html has rendered the html element of component. Here is my code:

.png
chart

.png

html.png
html rendering code, data rendering failed

but with static data in the subcomponents, the rendering is successful.

add:

later debugging found that in the created function, the data is obtained asynchronously, but the data passed into the subcomponent is empty, which is the initial value in data

.

I hope people who have encountered related problems can provide some solutions, thank you!

Mar.09,2021

mounted: function () {
  this.$nextTick(function () {
   //echarts
  })
}
Menu