Skip to content

Commit 67da622

Browse files
pi0yyx990803
authored andcommitted
feat(store): bind mutation and action handlers to store (#872)
1 parent fd2b188 commit 67da622

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/store.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,14 @@ function makeLocalGetters (store, namespace) {
373373
function registerMutation (store, type, handler, local) {
374374
const entry = store._mutations[type] || (store._mutations[type] = [])
375375
entry.push(function wrappedMutationHandler (payload) {
376-
handler(local.state, payload)
376+
handler.call(store, local.state, payload)
377377
})
378378
}
379379

380380
function registerAction (store, type, handler, local) {
381381
const entry = store._actions[type] || (store._actions[type] = [])
382382
entry.push(function wrappedActionHandler (payload, cb) {
383-
let res = handler({
383+
let res = handler.call(store, {
384384
dispatch: local.dispatch,
385385
commit: local.commit,
386386
getters: local.getters,

0 commit comments

Comments
 (0)