]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
feat allow relative navigation with query or hash params
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 16 Apr 2019 15:17:05 +0000 (17:17 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 16 Apr 2019 15:17:05 +0000 (17:17 +0200)
src/history/utils.ts
src/router.ts

index d3eb2900bd37aa5952ce3dd6272ea05bc644ee69..0df4ede8819df4abfb331d06727f79cab8959706 100644 (file)
@@ -3,6 +3,7 @@ import {
   HistoryQuery,
   HistoryLocation,
 } from './base'
+import { RouteQuery } from '../types'
 
 const PERCENT_RE = /%/g
 
@@ -108,6 +109,11 @@ export function stringifyQuery(query: HistoryQuery): string {
   return search
 }
 
+export function normalizeQuery(query: RouteQuery): HistoryQuery {
+  // TODO: implem
+  return query as HistoryQuery
+}
+
 /**
  * Prepare a URI string to be passed to pushState
  * @param uri
index 1f15d77d1fb350857dc935e04305e73f6cfd4002..d874252fe883a18b49fd03e0c0f5606213a5772b 100644 (file)
@@ -51,7 +51,11 @@ export class Router {
       // named or relative route
       // we need to resolve first
       location = this.matcher.resolve(to, this.currentRoute)
-      url = this.history.utils.normalizeLocation(location)
+      url = this.history.utils.normalizeLocation({
+        query: this.history.utils.normalizeQuery(to.query || {}),
+        hash: to.hash,
+        ...location,
+      })
     }
 
     // TODO: call hooks, guards