Skip to content

Commit 1f7411e

Browse files
cgarnieryyx990803
authored andcommitted
Add route name (#11)
Add the route name. Sometime route name is more usefull then the path.
1 parent 89347b6 commit 1f7411e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ exports.sync = function (store, router) {
3232
store.dispatch('router/ROUTE_CHANGED', {
3333
path: to.path,
3434
query: to.query,
35+
name: to.name,
3536
params: to.params
3637
})
3738
})
@@ -43,6 +44,7 @@ function patchStore (store) {
4344
store._dispatching = true
4445
set(store.state, 'route', {
4546
path: '',
47+
name: '',
4648
query: null,
4749
params: null
4850
})
@@ -54,6 +56,7 @@ function patchStore (store) {
5456
mutations: {
5557
'router/ROUTE_CHANGED': function (state, to) {
5658
state.path = to.path
59+
state.name = to.name
5760
state.query = to.query
5861
state.params = to.params
5962
}

0 commit comments

Comments
 (0)