chore(vue-app): use serializeFunction when appropriate (#4575)

This commit is contained in:
Jonas Galvez 2018-12-17 15:26:23 -02:00 committed by Xin Du (Clark)
parent afd1cd3247
commit 25d26ba42f
1 changed files with 3 additions and 3 deletions

View File

@ -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 %>
})
}