LoginSignup
0
0

More than 3 years have passed since last update.

Vue.js(Vuex) で mapActions に別名(エイリアス)を付けて扱う

Posted at

  • update/index.js に定義されているupdateというアクションを、

    このインスタンスの中では this.updateAction とCallできる。

  • エイリアスは同名でも、問題なし。

  • 名前が衝突すると、無限ループになったりするので、そういう時に使った。


import { mapActions } from 'vuex'

export default {
  // ...
  methods: {
    ...mapActions("update", {
      updateAction: "update",
      clearForms: "clearForms"
    }),
  }
}

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