Vue routing permissions

The

problem is:
/ / parent route
{
path:"/a",
computends:a,
meta: {auth:"a"}
}
/ / Child route
{
path:"/a/b"
computends:b,
}
ask
when the parent route has permission, the child route can enter a route such as / Ab without setting meta,

.
Mar.02,2021

does not block globally. Write permission check under that route


process in [router.beforeEach ((to, from, next) = > {]:
router.beforeEach ((to, from, next) = > {

let ps = to.matched
let meta = null
for (let p of ps) {
  if (p.meta) {
    meta = p.meta //meta
  }
}
// meta
Menu