풀스택 개발 공부로그

Nuxt dynamic routes

|

nuxt dynamic routes

Dynamic Routes - A Vue.js Lesson From our Vue.js Course: Nuxt.js…

Named Routes

Named Routes | Vue Router Sometimes it is more convenient to identify a route with a name, especially when linking to a route or performing navigations. You can give a route a name in the routes options while creating the Router instance:

const router = new VueRouter({
  routes: [
    {
      path: /user/:userId,
      name: user,
      component: User
    }
  ]
})
<router-link :to={ name: user, params: { userId: 123 }}>User</router-link>

This is the exact same object used programatically with

router.push({ name: user, params: { userId: 123 }})

In both cases, the router will navigate to the path

nested routes

nuxt : Routing - NuxtJS

nuxt-api : API: The <nuxt-child> Component - NuxtJS