@@ -24,11 +24,6 @@ router.beforeEach(function (to, from, next) {
24
24
to . query . _ = guid ( ) ;
25
25
}
26
26
27
- Vue . prototype . currentRoute = [ {
28
- route : to . path . replace ( / ^ \/ / , '' ) ,
29
- uri : to . path . replace ( / ^ \/ / , '' ) ,
30
- options : to . query
31
- } ] ;
32
27
let toPath = decodeURI ( to . fullPath ) ; // 兼容 vue-router 浏览器前进/返回时的 decodeURI操作
33
28
let fromPath = decodeURI ( from . fullPath ) ;
34
29
const browserHistoryArr = browserHistory . list ;
@@ -77,7 +72,10 @@ router.beforeEach(function (to, from, next) {
77
72
|| - 1 === browserHistoryIndex
78
73
|| browserHistoryIndex !== browserHistoryLength - 1 ) {
79
74
browserHistoryArr . push ( {
80
- path : toPath
75
+ path : toPath ,
76
+ route : to . path . replace ( / ^ \/ / , '' ) ,
77
+ uri : to . path . replace ( / ^ \/ / , '' ) ,
78
+ options : to . query
81
79
} ) ;
82
80
}
83
81
}
@@ -86,6 +84,7 @@ router.beforeEach(function (to, from, next) {
86
84
// browserHistoryArr = [];
87
85
// browserHistoryArr.push({path: to.fullPath});
88
86
// }
87
+ Vue . prototype . currentRoute = browserHistoryArr ;
89
88
browserHistory . set ( browserHistoryArr ) ;
90
89
router . app . $nextTick ( ( ) => {
91
90
const browserHistoryArr = browserHistory . list ;
0 commit comments