Skip to content

Commit 2891953

Browse files
committed
make the route module namespaced
1 parent 828024f commit 2891953

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ exports.sync = function (store, router, options) {
22
var moduleName = (options || {}).moduleName || 'route'
33

44
store.registerModule(moduleName, {
5+
namespaced: true,
56
state: cloneRoute(router.currentRoute),
67
mutations: {
7-
'router/ROUTE_CHANGED': function (state, transition) {
8+
'ROUTE_CHANGED': function (state, transition) {
89
store.state[moduleName] = cloneRoute(transition.to, transition.from)
910
}
1011
}
@@ -37,7 +38,7 @@ exports.sync = function (store, router, options) {
3738
return
3839
}
3940
currentPath = to.fullPath
40-
store.commit('router/ROUTE_CHANGED', { to: to, from: from })
41+
store.commit(moduleName + '/ROUTE_CHANGED', { to: to, from: from })
4142
})
4243
}
4344

0 commit comments

Comments
 (0)