From: Eduardo San Martin Morote Date: Tue, 24 Mar 2020 10:28:49 +0000 (+0100) Subject: feat(history): expose state on html5 X-Git-Tag: v4.0.0-alpha.4~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f83607c8798960f49cdb5eed8fdfe8adc52fabf;p=thirdparty%2Fvuejs%2Frouter.git feat(history): expose state on html5 --- diff --git a/src/history/common.ts b/src/history/common.ts index 506e5732..0eb47fff 100644 --- a/src/history/common.ts +++ b/src/history/common.ts @@ -71,6 +71,7 @@ export type ValueContainer = { value: T } export interface RouterHistory { readonly base: string readonly location: HistoryLocationNormalized + readonly state: HistoryState // readonly location: ValueContainer push(to: RawHistoryLocation, data?: HistoryState): void diff --git a/src/history/html5.ts b/src/history/html5.ts index a5249a07..ffc79384 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -297,5 +297,9 @@ export default function createWebHistory(base: string = ''): RouterHistory { get: () => historyNavigation.location.value, }) + Object.defineProperty(routerHistory, 'state', { + get: () => historyNavigation.state.value, + }) + return routerHistory }