If you simply request the data and get the new option for a simple assignment,echarts will not redraw. The data is obtained, but the new option and data are not reused to display the chart
Solution: Listen for option changes in the watch (option is an object, so you need to listen deeply). When the option changes are heard, trigger the new option and data to display the chart. The specific code is as follows
Why is getting and initializing the DOM in Mounted? In the mounted life cycle, the DOM is mounted to the vue instance. In short, before this, the DOM tree has not been fully formed, so it is not possible to obtain the DOM structure
Why is the data event ready and still not rendering the chart? Check to see if you have specified width and height = = for the chart’s container div
If you have other questions, please leave a message and let us discuss together