Skip to content

Commit ea234a5

Browse files
fnlctrlyyx990803
authored andcommitted
Fix params passed to scrollHandler (fix #1207) (#1209)
Should capture `this.current`(the `from` route) before making the transition
1 parent 571ed97 commit ea234a5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/history/html5.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@ export class HTML5History extends History {
3030
}
3131

3232
push (location: RawLocation, onComplete?: Function, onAbort?: Function) {
33+
const { current: fromRoute } = this
3334
this.transitionTo(location, route => {
3435
pushState(cleanPath(this.base + route.fullPath))
35-
handleScroll(this.router, route, this.current, false)
36+
handleScroll(this.router, route, fromRoute, false)
3637
onComplete && onComplete(route)
3738
}, onAbort)
3839
}
3940

4041
replace (location: RawLocation, onComplete?: Function, onAbort?: Function) {
42+
const { current: fromRoute } = this
4143
this.transitionTo(location, route => {
4244
replaceState(cleanPath(this.base + route.fullPath))
43-
handleScroll(this.router, route, this.current, false)
45+
handleScroll(this.router, route, fromRoute, false)
4446
onComplete && onComplete(route)
4547
}, onAbort)
4648
}

0 commit comments

Comments
 (0)