I don't know how to call, multiple NamespacedHelpers with vuex, i tried this:
import { createNamespacedHelpers } from 'vuex'
const { mapActions, mapMutations } = createNamespacedHelpers(['payments', 'auth'])
methods: {
...mapActions(['registerBankData', 'updateBankData', 'getBankData'], ['login']),
...mapMutations(['setBankData']),
...
}
Also tried this:
import { createNamespacedHelpers } from 'vuex'
const { mapActions, mapMutations } = createNamespacedHelpers('payments', 'auth')
methods: {
...mapActions(['registerBankData', 'updateBankData', 'getBankData', 'login']),
...mapMutations(['setBankData']),
...
}
but doesn't work..
Try something like that:
import { mapMutations, mapActions } from 'vuex';
export default {
methods: {
...mapMutations({
myMutation: 'myModule/myMutation',
}),
...mapActions({
myAction: 'myModule/myAction',
}),
}
}
I believe you can do this
import { createNamespacedHelpers } from 'vuex'
const payments = createNamespacedHelpers('payments')
const auth = createNamespacedHelpers('auth')
methods: {
...payments.mapActions(['registerBankData', 'updateBankData', 'getBankData']),
...auth.mapActions(['authAction', 'login']),
...payments.mapMutations(['setBankData']),
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.