For example, my case is to request public data in a public component. The request in the subcomponent depends on the public data. If the public data has not yet requested the data, the subcomponent will report an error when it starts to request, because the request in the subcomponent The parameter is the result of the request in the public component, and vuex is used to pass the data. How can the public data request be completed before the sub-component starts requesting? ? ?
You can use vue’s watch and wathc to make sub-component ajax requests only when the data in vuex exists
You can introduce a message subscription model
https://github.com/holdnoWby/...
The same is used in VUE
Refer to /q/10... this answer
Thank you for your answers, but I solved it very simply with my own method. To execute this.$store.dispatch('setHomeData') request on the APP.vue page, just add v-if=" on the router-view tag. homeData" will do. As long as there is data, the subcomponent page will appear and the request inside will be executed.