From: Eduardo San Martin Morote Date: Tue, 21 Apr 2020 12:01:35 +0000 (+0200) Subject: feat(router): add back,forward,go X-Git-Tag: v4.0.0-alpha.8~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e927b5ab8a09c2941edbec7c6af145323c6d3eb;p=thirdparty%2Fvuejs%2Frouter.git feat(router): add back,forward,go --- diff --git a/src/router.ts b/src/router.ts index 269a4c62..3bb36841 100644 --- a/src/router.ts +++ b/src/router.ts @@ -104,6 +104,11 @@ export interface Router { push(to: RouteLocationRaw): Promise replace(to: RouteLocationRaw): Promise + // TODO: return a promise when https://github.com/vuejs/rfcs/pull/150 is + // merged + back(): void + forward(): void + go(distance: number): void beforeEach(guard: NavigationGuardWithThis): () => void afterEach(guard: PostNavigationGuard): () => void @@ -605,10 +610,13 @@ export function createRouter({ removeRoute, hasRoute, getRoutes, + resolve, push, replace, - resolve, + go: history.go, + back: () => history.go(-1), + forward: () => history.go(1), beforeEach: beforeGuards.add, afterEach: afterGuards.add,