Vue router inherit parent properties
To answer my own question: https://github.com/vuejs/vue-router/issues/704
I didn't realise this was deprecated in Vue-router 2.0, it is possible to get the matched route and find the meta there.
With vue-router v.3 to match parent's meta (for example: in beforeEach()
func. ) You need to use to.matched.some()
like this:
router.beforeEach((to, from, next) => { if (to.matched.some(record => record.meta.auth)) { // ... next({name:'route-name'}) } else { next() }}