vuexを使用しているのですが、
その際に、componentからmapActionsを使ってactionを呼び出しています。
そのこに、createdがあり、そこでもactionで実装した関数を実行しているのですが、
これはどういうことなのでしょうか?
export default { methods: { ...mapActions([ 'getProfile' ]) // <== actionの呼び出し }, components: { ShoppingCartLimit }, created () { this.getProfile() // <==ここでactionの実行? } }
// action export const getProfile = ({ commit }) => { api.getProfile((profile) => { commit('RECEIVE_PROFILE', profile) }) }
// api export default { getProfile (cb) { cb(profile) } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/08/21 08:08