-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow function for mapMutations/mapActions like mapState #750
Comments
Do you mean you want to statically set a mutation payload in methods: {
...mapMutations({
increment: 'increment'
}),
someMethod () {
this.increment({ addNum: 10 })
}
} |
because the mapState can do like this. |
Because that would make the payload static |
and a component mutation is more the u defined the function is more。 ithink is nogood |
Sorry, I don't understand you... |
I'm afraid I don't understand about this... state has no payload.
We always need to call the mapped method even if we can set a payload in helpers. I don't think it has a large difference. I also think we can set the value in actions or mutations if it is really static. methods: {
...mapMutations({
increment: {
type: 'increment',
addNum: 10
}
}),
someMethod () {
this.increment()
}
} |
So so so sry , my english is very poor,if i can‘t express my means,i will be abandon;
I means : mutation can be define like countPlusLocalState to pass mutations;
I think in componet, all about moutation in mapMutations; |
I see. You need a payload converter between a component and a mutation in |
I especially thank you for your patience. |
Indeed. so the complete api looks like below? mapMutations(namespace, {
someMutation (commit, payload) {
// ...
commit(type, payload)
}
})
// ...
vm.someMutation({ value: 123 }) I think mapActions should also have similar API in that case. mapActions(namespace, {
someAction (dispatch, payload) {
// ...
dispatch(type, payload)
}
}) |
What problem does this feature solve?
in function normalizeNamespace
make payload to string is so pain;
can we add the typeOf(val) to judege this type?
my English is poor, please forgive me
What does the proposed API look like?
I want to use mapMutations set payload mutations,like
Vuex.mapMutations({
increame: {
type: 'increame',
addNum: 10
}
})
The text was updated successfully, but these errors were encountered: