File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ exports.sync = function (store, router) {
2
2
patchStore ( store )
3
3
store . router = router
4
4
5
+ var commit = store . commit || store . dispatch
5
6
var isTimeTraveling = false
6
7
var currentPath
7
8
@@ -29,20 +30,28 @@ exports.sync = function (store, router) {
29
30
}
30
31
var to = transition . to
31
32
currentPath = to . path
32
- store . dispatch ( 'router/ROUTE_CHANGED' , to )
33
+ commit ( 'router/ROUTE_CHANGED' , to )
33
34
} )
34
35
}
35
36
37
+ function applyMutationState ( store , state ) {
38
+ // support above 2.0
39
+ if ( store . hasOwnProperty ( '_committing' ) ) {
40
+ return store . _committing = state
41
+ }
42
+ return store . _dispatching = state
43
+ }
44
+
36
45
function patchStore ( store ) {
37
46
// add state
38
47
var set = store . _vm . constructor . set
39
- store . _dispatching = true
48
+ applyMutationState ( store , true ) ;
40
49
set ( store . state , 'route' , {
41
50
path : '' ,
42
51
query : null ,
43
52
params : null
44
53
} )
45
- store . _dispatching = false
54
+ applyMutationState ( store , false ) ;
46
55
// add mutations
47
56
store . hotUpdate ( {
48
57
modules : {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vuex-router-sync" ,
3
- "version" : " 2.0.0 " ,
3
+ "version" : " 2.0.1 " ,
4
4
"description" : " Effortlessly keep vue-router and vuex store in sync." ,
5
5
"main" : " index.js" ,
6
6
"repository" : {
19
19
},
20
20
"homepage" : " https://github.com/vuejs/vuex-router-sync#readme" ,
21
21
"peerDependencies" : {
22
- "vuex" : " >=0.6.2" ,
22
+ "vuex" : " >= 0.6.2 < 3 " ,
23
23
"vue-router" : " >=0.7.11"
24
24
}
25
25
}
You can’t perform that action at this time.
0 commit comments