mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
chore(vue-app): use serializeFunction when appropriate (#4575)
This commit is contained in:
parent
afd1cd3247
commit
25d26ba42f
@ -49,7 +49,7 @@ const _routes = recursiveRoutes(router.routes, ' ', _components, 2)
|
|||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
<% if (router.scrollBehavior) { %>
|
<% if (router.scrollBehavior) { %>
|
||||||
const scrollBehavior = <%= serialize(router.scrollBehavior).replace(/scrollBehavior\s*\(/, 'function(').replace('function function', 'function') %>
|
const scrollBehavior = <%= serializeFunction(router.scrollBehavior) %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
window.history.scrollRestoration = 'manual'
|
window.history.scrollRestoration = 'manual'
|
||||||
@ -112,8 +112,8 @@ export function createRouter() {
|
|||||||
<%= isTest ? '/* eslint-disable quotes */' : '' %>
|
<%= isTest ? '/* eslint-disable quotes */' : '' %>
|
||||||
routes: [<%= _routes %>],
|
routes: [<%= _routes %>],
|
||||||
<%= isTest ? '/* eslint-enable quotes */' : '' %>
|
<%= isTest ? '/* eslint-enable quotes */' : '' %>
|
||||||
<% if (router.parseQuery) { %>parseQuery: <%= serialize(router.parseQuery).replace('parseQuery(', 'function(') %>,<% } %>
|
<% if (router.parseQuery) { %>parseQuery: <%= serializeFunction(router.parseQuery) %>,<% } %>
|
||||||
<% if (router.stringifyQuery) { %>stringifyQuery: <%= serialize(router.stringifyQuery).replace('stringifyQuery(', 'function(') %>,<% } %>
|
<% if (router.stringifyQuery) { %>stringifyQuery: <%= serializeFunction(router.stringifyQuery) %>,<% } %>
|
||||||
fallback: <%= router.fallback %>
|
fallback: <%= router.fallback %>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user