From 8eb519b16b85014ac2492bfc5a649f7002accda2 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Tue, 14 Nov 2017 11:06:06 +0800 Subject: [PATCH 1/2] feat: add parseQuery and stringifyQuery for router --- lib/app/router.js | 2 ++ lib/common/options.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/app/router.js b/lib/app/router.js index 8312556090..e7f997d7e3 100644 --- a/lib/app/router.js +++ b/lib/app/router.js @@ -60,6 +60,8 @@ export function createRouter () { routes: [ <%= _routes %> ], + parseQuery: <%= router.parseQuery %>, + stringifyQuery: <%= router.stringifyQuery %>, fallback: <%= router.fallback %> }) } diff --git a/lib/common/options.js b/lib/common/options.js index 672a216c85..408613ba29 100755 --- a/lib/common/options.js +++ b/lib/common/options.js @@ -271,6 +271,8 @@ Options.defaults = { linkExactActiveClass: 'nuxt-link-exact-active', extendRoutes: null, scrollBehavior: null, + parseQuery: false, + stringifyQuery: false, fallback: false }, render: { From 679d48c8c02b188a69c04bee4a8dedd8a208f669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 14 Nov 2017 10:28:18 +0100 Subject: [PATCH 2/2] Update router.js --- lib/app/router.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/router.js b/lib/app/router.js index e7f997d7e3..efad4256db 100644 --- a/lib/app/router.js +++ b/lib/app/router.js @@ -60,8 +60,8 @@ export function createRouter () { routes: [ <%= _routes %> ], - parseQuery: <%= router.parseQuery %>, - stringifyQuery: <%= router.stringifyQuery %>, + <% if (router.parseQuery) { %>parseQuery: <%= serialize(router.parseQuery).replace('parseQuery(', 'function(') %>,<% } %> + <% if (router.stringifyQuery) { %>stringifyQuery: <%= serialize(router.stringifyQuery).replace('stringifyQuery(', 'function(') %>,<% } %> fallback: <%= router.fallback %> }) }