mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
add support to vue-router redirect in extendRoutes
This commit is contained in:
parent
1080dfdbd6
commit
8cb4188aa0
@ -7,8 +7,9 @@ import Router from 'vue-router'
|
||||
route._name = '_' + hash(route.component)
|
||||
components.push({ _name: route._name, component: route.component, name: route.name, chunkName: route.chunkName })
|
||||
res += tab + '{\n'
|
||||
res += tab + '\tpath: ' + JSON.stringify(route.path) + ',\n'
|
||||
res += tab + '\tcomponent: ' + (splitPages ? route._name : `() => ${route._name}.default || ${route._name}`)
|
||||
res += tab + '\tpath: ' + JSON.stringify(route.path)
|
||||
res += (route.component) ? ',\n\t' + tab + 'component: ' + (splitPages ? route._name : `() => ${route._name}.default || ${route._name}`) : ''
|
||||
res += (route.redirect) ? ',\n\t' + tab + 'redirect: ' + JSON.stringify(route.redirect) : ''
|
||||
res += (route.name) ? ',\n\t' + tab + 'name: ' + JSON.stringify(route.name) : ''
|
||||
res += (route.children) ? ',\n\t' + tab + 'children: [\n' + recursiveRoutes(routes[i].children, tab + '\t\t', components) + '\n\t' + tab + ']' : ''
|
||||
res += '\n' + tab + '}' + (i + 1 === routes.length ? '' : ',\n')
|
||||
@ -18,6 +19,7 @@ import Router from 'vue-router'
|
||||
const _components = []
|
||||
const _routes = recursiveRoutes(router.routes, '\t\t', _components)
|
||||
%><%= uniqBy(_components, '_name').map((route) => {
|
||||
if (!route.component) return ''
|
||||
const path = relativeToBuild(route.component)
|
||||
const chunkName = wChunk(route.chunkName)
|
||||
const name = route._name
|
||||
|
Loading…
Reference in New Issue
Block a user