@@ -2,15 +2,16 @@ exports.sync = function (store, router) {
2
2
store . registerModule ( 'route' , {
3
3
state : { } ,
4
4
mutations : {
5
- 'router/ROUTE_CHANGED' : function ( state , to ) {
5
+ 'router/ROUTE_CHANGED' : function ( state , transition ) {
6
6
store . state . route = Object . freeze ( {
7
- name : to . name ,
8
- path : to . path ,
9
- hash : to . hash ,
10
- query : to . query ,
11
- params : to . params ,
12
- fullPath : to . fullPath ,
13
- meta : to . meta
7
+ name : transition . to . name ,
8
+ path : transition . to . path ,
9
+ hash : transition . to . hash ,
10
+ query : transition . to . query ,
11
+ params : transition . to . params ,
12
+ fullPath : transition . to . fullPath ,
13
+ meta : transition . to . meta ,
14
+ from : transition . from
14
15
} )
15
16
}
16
17
}
@@ -34,12 +35,12 @@ exports.sync = function (store, router) {
34
35
)
35
36
36
37
// sync store on router navigation
37
- router . afterEach ( function ( to ) {
38
+ router . afterEach ( function ( to , from ) {
38
39
if ( isTimeTraveling ) {
39
40
isTimeTraveling = false
40
41
return
41
42
}
42
43
currentPath = to . fullPath
43
- store . commit ( 'router/ROUTE_CHANGED' , to )
44
+ store . commit ( 'router/ROUTE_CHANGED' , { to : to , from : from } )
44
45
} )
45
46
}
0 commit comments