I try to access route.meta on nuxt.js custom route.
I have set up this custom route in nuxt.config.js
router: {
extendRoutes (routes, resolve) {
routes.push({
path: '*',
component: resolve(__dirname, 'my-component.vue'),
meta: { accessToken: 'mydata' }
})
}
},
Then I try from inside this component to get this meta value Ideally I want to have access to it thought my asyncData function.
Any ideas?
Sure you can access meta inside asyncData
, take a look at the sample
export default {
asyncData(ctx) {
const { route } = ctx;
console.log(route.meta);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With