vue.js/nuxt.js 에서 mapActios를 사용할 때마다 항상 헷갈려서 간단하게 기록해 둔다.
ex) nuxt.js
<script>
import { mapActions } from "vuex";
export default {
data() {
return {
users: [],
}
},
methods: {
...mapActions("user", ["getUserList"]), // module, ['action name']
},
async created() {
this.users = await this.getUserList();
// this.users = this.$store.dispatch("user/getUserList");
},
}
</script>