router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.name == 'Admin')) {
console.log('我是Admin');
next()
} else {
console.log('我是发布页');
next() // 确保一定要调用 next()
}
})
})
搜索
router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.name == 'Admin')) {
console.log('我是Admin');
next()
} else {
console.log('我是发布页');
next() // 确保一定要调用 next()
}
})
})