File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,7 @@ exports.sync = function (store, router) {
29
29
}
30
30
var to = transition . to
31
31
currentPath = to . path
32
- store . dispatch ( 'router/ROUTE_CHANGED' , {
33
- path : to . path ,
34
- query : to . query ,
35
- name : to . name ,
36
- params : to . params
37
- } )
32
+ store . dispatch ( 'router/ROUTE_CHANGED' , to )
38
33
} )
39
34
}
40
35
@@ -44,7 +39,6 @@ function patchStore (store) {
44
39
store . _dispatching = true
45
40
set ( store . state , 'route' , {
46
41
path : '' ,
47
- name : '' ,
48
42
query : null ,
49
43
params : null
50
44
} )
@@ -55,10 +49,16 @@ function patchStore (store) {
55
49
route : {
56
50
mutations : {
57
51
'router/ROUTE_CHANGED' : function ( state , to ) {
58
- state . path = to . path
59
- state . name = to . name
60
- state . query = to . query
61
- state . params = to . params
52
+ Object . keys ( to ) . forEach ( key => {
53
+ if ( key !== 'matched' ) {
54
+ set ( state , key , to [ key ] )
55
+ }
56
+ } )
57
+ Object . keys ( state ) . forEach ( key => {
58
+ if ( ! ( key in to ) ) {
59
+ state [ key ] = null
60
+ }
61
+ } )
62
62
}
63
63
}
64
64
}
You can’t perform that action at this time.
0 commit comments