File tree Expand file tree Collapse file tree 4 files changed +9
-42
lines changed
routing-vue-router/src/views
server-side-rendering/src Expand file tree Collapse file tree 4 files changed +9
-42
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,8 @@ export default {
67
67
}).href ;
68
68
},
69
69
onUpdate (cb ) {
70
- this ._onPopState = event => {
71
- const routeState = event .state ;
72
- // at initial load, the state is read from the URL without
73
- // update. Therefore the state object is not there. In this
74
- // case we fallback and read the URL.
75
- if (! routeState) {
76
- cb (this .read ());
77
- } else {
78
- cb (routeState);
79
- }
70
+ this ._onPopState = () => {
71
+ cb (this .read ());
80
72
};
81
73
window .addEventListener (' popstate' , this ._onPopState );
82
74
},
Original file line number Diff line number Diff line change @@ -74,22 +74,13 @@ export async function createApp({
74
74
return ;
75
75
}
76
76
// TODO: handle vue route changes
77
- this . _onPopState = event => {
77
+ this . _onPopState = ( ) => {
78
78
if ( this . writeTimer ) {
79
79
window . clearTimeout ( this . writeTimer ) ;
80
80
this . writeTimer = undefined ;
81
81
}
82
82
83
- const routeState = event . state ;
84
-
85
- // At initial load, the state is read from the URL without update.
86
- // Therefore the state object is not available.
87
- // In this case, we fallback and read the URL.
88
- if ( ! routeState ) {
89
- callback ( this . read ( ) ) ;
90
- } else {
91
- callback ( routeState ) ;
92
- }
83
+ callback ( this . read ( ) ) ;
93
84
} ;
94
85
95
86
window . addEventListener ( 'popstate' , this . _onPopState ) ;
@@ -119,7 +110,7 @@ export async function createApp({
119
110
}
120
111
} ,
121
112
router,
122
- render : h => h ( App ) ,
113
+ render : ( h ) => h ( App ) ,
123
114
} ) ;
124
115
125
116
const result = {
Original file line number Diff line number Diff line change @@ -53,16 +53,8 @@ export function createApp({ renderToString, context } = {}) {
53
53
return router . resolve ( { query : routeState } ) . href ;
54
54
} ,
55
55
onUpdate ( callback ) {
56
- this . _onPopState = ( event ) => {
57
- const routeState = event . state ;
58
- // at initial load, the state is read from the URL without
59
- // update. Therefore the state object is not there. In this
60
- // case we fallback and read the URL.
61
- if ( ! routeState ) {
62
- callback ( this . read ( ) ) ;
63
- } else {
64
- callback ( routeState ) ;
65
- }
56
+ this . _onPopState = ( ) => {
57
+ callback ( this . read ( ) ) ;
66
58
} ;
67
59
typeof window === 'object' &&
68
60
window . addEventListener ( 'popstate' , this . _onPopState ) ;
Original file line number Diff line number Diff line change @@ -49,16 +49,8 @@ export function createApp({ renderToString, context } = {}) {
49
49
return router . resolve ( { query : routeState } ) . href ;
50
50
} ,
51
51
onUpdate ( callback ) {
52
- this . _onPopState = event => {
53
- const routeState = event . state ;
54
- // at initial load, the state is read from the URL without
55
- // update. Therefore the state object is not there. In this
56
- // case we fallback and read the URL.
57
- if ( ! routeState ) {
58
- callback ( this . read ( ) ) ;
59
- } else {
60
- callback ( routeState ) ;
61
- }
52
+ this . _onPopState = ( ) => {
53
+ callback ( this . read ( ) ) ;
62
54
} ;
63
55
typeof window === 'object' &&
64
56
window . addEventListener ( 'popstate' , this . _onPopState ) ;
You can’t perform that action at this time.
0 commit comments