feat(vue-app): export router options (#6231)

This commit is contained in:
Ricardo Gobbo de Souza 2019-08-14 16:38:25 -03:00 committed by Pooya Parsa
parent 35ba65562f
commit 2ad6bf2a08

View File

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