In vue, async/await is written in store, or in .vue file template.

some async/await are written in the action of vuex, and some are written in the .vue file method. Where should I write it?

Jun.15,2021

this mainly depends on whether your data is used in the current component or whether it needs to be shared by multiple components. If the component is exclusive, put it in .vue, on the contrary, put it in vuex


action can do asynchronous operation. Split it out as much as possible, and don't put it in .vue

.
Menu