3
2

More than 3 years have passed since last update.

[Vuex] 複数のdispatchを全て実行するにはPromise.allを使う

Posted at

VuexのActionsを実行するトリガーとなるdispatch
複数全て実行したい場合には
Promise.all
を使うと実装できます。

index.vue
<script>
export default {
  async fetch({ store }) {
    await Promise.all([
      store.dispatch('〜〜〜'),
      store.dispatch('〜〜〜'),
      store.dispatch('〜〜〜')
    ])
  }
}
</script>
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2