亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - How does vue axios control the execution order in different components?
phpcn_u1582
phpcn_u1582 2017-07-05 11:08:21
0
3
1301

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? ? ?

phpcn_u1582
phpcn_u1582

reply all(3)
習(xí)慣沉默

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template