mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
feat(vue-app): export router options (#6231)
This commit is contained in:
parent
35ba65562f
commit
2ad6bf2a08
@ -84,18 +84,20 @@ const _routes = recursiveRoutes(router.routes, ' ', _components, 2)
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
export function createRouter() {
|
||||
return new Router({
|
||||
mode: '<%= router.mode %>',
|
||||
base: decodeURI('<%= router.base %>'),
|
||||
linkActiveClass: '<%= router.linkActiveClass %>',
|
||||
linkExactActiveClass: '<%= router.linkExactActiveClass %>',
|
||||
scrollBehavior,
|
||||
<%= isTest ? '/* eslint-disable quotes, object-curly-spacing, key-spacing */' : '' %>
|
||||
routes: [<%= _routes %>],
|
||||
<%= isTest ? '/* eslint-enable quotes, object-curly-spacing, key-spacing */' : '' %>
|
||||
<% if (router.parseQuery) { %>parseQuery: <%= serializeFunction(router.parseQuery) %>,<% } %>
|
||||
<% if (router.stringifyQuery) { %>stringifyQuery: <%= serializeFunction(router.stringifyQuery) %>,<% } %>
|
||||
fallback: <%= router.fallback %>
|
||||
})
|
||||
export const routerOptions = {
|
||||
mode: '<%= router.mode %>',
|
||||
base: decodeURI('<%= router.base %>'),
|
||||
linkActiveClass: '<%= router.linkActiveClass %>',
|
||||
linkExactActiveClass: '<%= router.linkExactActiveClass %>',
|
||||
scrollBehavior,
|
||||
<%= isTest ? '/* eslint-disable quotes, object-curly-spacing, key-spacing */' : '' %>
|
||||
routes: [<%= _routes %>],
|
||||
<%= isTest ? '/* eslint-enable quotes, object-curly-spacing, key-spacing */' : '' %>
|
||||
<% if (router.parseQuery) { %>parseQuery: <%= serializeFunction(router.parseQuery) %>,<% } %>
|
||||
<% if (router.stringifyQuery) { %>stringifyQuery: <%= serializeFunction(router.stringifyQuery) %>,<% } %>
|
||||
fallback: <%= router.fallback %>
|
||||
}
|
||||
|
||||
export function createRouter() {
|
||||
return new Router(routerOptions)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user