From 5e927b5ab8a09c2941edbec7c6af145323c6d3eb Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 21 Apr 2020 14:01:35 +0200 Subject: [PATCH] feat(router): add back,forward,go --- src/router.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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, -- 2.47.3