Skip to content

Commit 600cae2

Browse files
committed
use 2.0 module API
1 parent 81195bb commit 600cae2

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

index.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,23 @@ function patchStore (store) {
5252
params: null
5353
})
5454
applyMutationState(store, false);
55-
// add mutations
56-
store.hotUpdate({
57-
modules: {
58-
route: {
59-
mutations: {
60-
'router/ROUTE_CHANGED': function (state, to) {
61-
store.state.route = to
62-
}
63-
}
55+
56+
var routeModule = {
57+
mutations: {
58+
'router/ROUTE_CHANGED': function (state, to) {
59+
store.state.route = to
6460
}
6561
}
66-
})
62+
}
63+
64+
// add module
65+
if (store.module) {
66+
store.module('route', routeModule)
67+
} else {
68+
store.hotUpdate({
69+
modules: {
70+
route: routeModule
71+
}
72+
})
73+
}
6774
}

0 commit comments

Comments
 (0)