Last active
July 30, 2021 02:40
-
-
Save nickbasile/63c8d6ad3f29c18a1620d6b60769c548 to your computer and use it in GitHub Desktop.
How to use a namespaced action in a Vue.js component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<button @click="increment">Increment</button> | |
</div> | |
</template> | |
<script> | |
import { mapActions } from 'vuex' | |
export default{ | |
methods: { | |
...mapActions({ | |
'increment': 'namespace/actionMethod' | |
}) | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have problems using VUEX namespaced modules, I have an actions and mutation types files, How I am supposed to dispatch a module/action using a const name
export const FETCH_INSTITUCIONES = 'fetchInstituciones'
Before using namespaced modules I called
this.$store.dispatch(FETCH_INSTITUCIONES)
but it doesn´t work anymore, do you know how it's gotta be?