diff --git a/src/history/base.js b/src/history/base.js index 6911b71f6..3a96bb3ba 100644 --- a/src/history/base.js +++ b/src/history/base.js @@ -81,9 +81,13 @@ export class History { this.confirmTransition( route, () => { + const prev = this.current this.updateRoute(route) onComplete && onComplete(route) this.ensureURL() + this.router.afterHooks.forEach(hook => { + hook && hook(route, prev) + }) // fire ready cbs once if (!this.ready) { @@ -214,12 +218,8 @@ export class History { } updateRoute (route: Route) { - const prev = this.current this.current = route this.cb && this.cb(route) - this.router.afterHooks.forEach(hook => { - hook && hook(route, prev) - }) } setupListeners () {