From 25d26ba42f97fa738592df4f85e692a557ffa1bf Mon Sep 17 00:00:00 2001 From: Jonas Galvez Date: Mon, 17 Dec 2018 15:26:23 -0200 Subject: [PATCH] chore(vue-app): use serializeFunction when appropriate (#4575) --- packages/vue-app/template/router.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vue-app/template/router.js b/packages/vue-app/template/router.js index 42ceb438e9..9bdb17f2a9 100644 --- a/packages/vue-app/template/router.js +++ b/packages/vue-app/template/router.js @@ -49,7 +49,7 @@ const _routes = recursiveRoutes(router.routes, ' ', _components, 2) Vue.use(Router) <% if (router.scrollBehavior) { %> -const scrollBehavior = <%= serialize(router.scrollBehavior).replace(/scrollBehavior\s*\(/, 'function(').replace('function function', 'function') %> +const scrollBehavior = <%= serializeFunction(router.scrollBehavior) %> <% } else { %> if (process.client) { window.history.scrollRestoration = 'manual' @@ -112,8 +112,8 @@ export function createRouter() { <%= isTest ? '/* eslint-disable quotes */' : '' %> routes: [<%= _routes %>], <%= isTest ? '/* eslint-enable quotes */' : '' %> - <% if (router.parseQuery) { %>parseQuery: <%= serialize(router.parseQuery).replace('parseQuery(', 'function(') %>,<% } %> - <% if (router.stringifyQuery) { %>stringifyQuery: <%= serialize(router.stringifyQuery).replace('stringifyQuery(', 'function(') %>,<% } %> + <% if (router.parseQuery) { %>parseQuery: <%= serializeFunction(router.parseQuery) %>,<% } %> + <% if (router.stringifyQuery) { %>stringifyQuery: <%= serializeFunction(router.stringifyQuery) %>,<% } %> fallback: <%= router.fallback %> }) }