Ask, I made a vue + echarts things, write data to death is no problem, but I won't send the request data in created, mounted inside the initialization echarts, loading, mounted inside can't get the data, but oneself write a click event, see data to fill up inside, found that the data is backfill up, how to solve the problem, the feeling is synchronous and asynchronous problem, when rendering echarts has not got back request data to begin to apply colours to a drawing, the back-end to the front-end, strives for the front end under the great god said ideas
CodePudding user response:
Add a watch to monitor data, the data change after re-execute setOption () method, when the dom parameter does not exist, call the initialize method
CodePudding user response:
You put the data on mounted inside request, after the completion of a request data in the echarts rendering
CodePudding user response:
Use $nextTick to render, sometimes because of the asynchronous problem, cause the page render first finished data didn't come back, then no update, you can use a synchronous request