[英]How to call multiple namespaced Modules in Vuex
I don't know how to call, multiple NamespacedHelpers with vuex, i tried this:我不知道如何使用 vuex 调用多个 NamespacedHelpers,我试过这个:
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']),
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.