From: Eduardo San Martin Morote Date: Tue, 16 Apr 2019 14:58:36 +0000 (+0200) Subject: feat: push entry to history X-Git-Tag: v4.0.0-alpha.0~443 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86c176377173d0001ffe875284c01ea96b44a439;p=thirdparty%2Fvuejs%2Frouter.git feat: push entry to history --- diff --git a/src/history/html5.ts b/src/history/html5.ts index 6871484a..e19d3fdb 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -79,7 +79,7 @@ export class HTML5History extends BaseHistory { ...buildState(this.location, normalized, null), ...data, } - cs.info('push', this.location, '->', to, 'with state', state) + cs.info('push', this.location, '->', normalized, 'with state', state) this.history.pushState(state, '', normalized.fullPath) this.location = normalized } diff --git a/src/history/utils.ts b/src/history/utils.ts index 13a5aeb9..d3eb2900 100644 --- a/src/history/utils.ts +++ b/src/history/utils.ts @@ -81,7 +81,7 @@ export function stringifyURL(location: HistoryLocation): string { let url = location.path let query = location.query ? stringifyQuery(location.query) : '' - return url + (query.length && '?' + query) + (location.hash || '') + return url + (query && '?' + query) + (location.hash || '') } /** diff --git a/src/router.ts b/src/router.ts index c3d30e38..950eb2af 100644 --- a/src/router.ts +++ b/src/router.ts @@ -49,11 +49,8 @@ export class Router { url = this.history.utils.normalizeLocation(location) } - console.log(location) - console.log('---') // TODO: call hooks, guards - // TODO: navigate - // this.history.push(location.fullPath) + this.history.push(url) this.currentRoute = { ...url, ...location,