when working on a MPVUE project, when the project is running and starting, there is an asynchronous method in app.vue (think of it as an entry program) that calls API. After the method is executed, the obtained parameters are assigned to the variables in $state. At this time, the client has already entered the main page, and the content displayed in the binding on the main page is the value in $state. Because it is slow to get the API return value at first, the corresponding content is not displayed on the main page.
there are two problems. How to solve the above situation? For example, let the API Synchronize request in app.vue display for a while the loading, request and then go to the main page?
When the value in the $state ofvuex changes, how to update the place where it is bound at the same time? Using the watch method?