Disable the layouts/ directory behavior into Nuxt and use a router.js instead (@nuxtjs/router)

Viewed 244

According to docs:

Every file (top-level) in the layouts directory will create a custom layout accessible with the layout property in the page components.

How can I set layout pages manualy in router.js (using @nuxt/router module) and disable nuxt default layout behavior. For example (prefered):

const router = new VueRouter({
  routes: [
    { 
      path: '/auth', component: Auth,
      children: [
       { path: 'login', component: AuthLogin },
       { path: 'register', component: AuthRegister }
      ]
    }
  ]
})

I dont want to set layout prop in every nested auth page

export default {
  layout: 'auth',
  // OR
  layout (context) {
    return 'auth'
  }
}
0 Answers
Related