Nuxt/examples/named-views/nuxt.config.js
Andrey Shertsinger b1b9e0bcbc feat(vue-app): support named views (#4410)
* support named views for extendRoutes config

* fix lint errors

* fix lint errors 2

* some refactoring

* var rename

* fixture & unit tests

* fix: style

* nuxt-child named view example and test

* nuxt element with named view in layout

* lint
2018-12-20 16:50:22 +01:00

31 lines
909 B
JavaScript

export default {
router: {
extendRoutes(routes, resolve) {
const indexIndex = routes.findIndex(route => route.name === 'index')
let index = routes[indexIndex].children.findIndex(route => route.name === 'index-child-id')
routes[indexIndex].children[index] = {
...routes[indexIndex].children[index],
components: {
default: routes[indexIndex].children[index].component,
left: resolve(__dirname, 'components/childLeft.vue')
},
chunkNames: {
left: 'components/childLeft'
}
}
index = routes.findIndex(route => route.name === 'main')
routes[index] = {
...routes[index],
components: {
default: routes[index].component,
top: resolve(__dirname, 'components/mainTop.vue')
},
chunkNames: {
top: 'components/mainTop'
}
}
}
}
}