How to add meta in nuxt router?

In vue, we defined meta like this:

const router = new VueRouter({
  routes: [
    {
      path: '/foo',
      component: Foo,
      children: [
        {
          path: 'bar',
          component: Bar,
          // a meta field
          meta: { requiresAuth: true }
        }
      ]
    }
  ]
})

But how do we define meta in nuxt?

Answer

You can use vue-router meta as custom component property. https://github.com/nuxt/nuxt.js/issues/1687#issuecomment-331870619

Simple example https://github.com/nuxt/nuxt.js/tree/2.x/examples/routes-meta