I have a route instance:
const router = new Router({
routes: [
{
path: '/',
name: 'Home',
component: MainContainer,
redirect: '/news/list',
children: [
{
path: 'advertisement/create',
name: 'Create Advertisement',
title: 'This is title of the page'
component: CreateAdvertisement
}
]
}
]
})
In my component, i tried to console this.$route but I got only name, path, component and there is no title property there. So my question is: Is this valid to pass a custom property via Vue router? If there is, where the problem with my attemp?
You can add to the meta:
const router = new Router({
routes: [
{
path: '/',
name: 'Home',
component: MainContainer,
redirect: '/news/list',
children: [
{
path: 'advertisement/create',
name: 'Create Advertisement',
title: 'This is title of the page'
component: CreateAdvertisement,
meta:{
// here
key: value
}
}
]
}
]
})
https://router.vuejs.org/guide/advanced/meta.html
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