router.beforeEach
router.beforeEach((to: any, from: any, next: any) => {
// console.log(to.path)
// const token = to.query.token || ''
// if (token !== '') {
// localStorage.setItem('DingToken', token)
// }
const { permissions } = store.state
console.log('permissions',permissions)
if (permissions.length > 0) {
const { meta } = to
const index = permissions.findIndex((item: any) => {
return item === meta.permissionsCode
})
if (meta.permissionsCode && index !== -1) {
next()
return
} else if (to.path !== '/default') {
if (meta.noVerify) {
next()
} else {
Message.error('无权限!')
next('/')
}
} else if (to.path === '/default') {
next()
}
} else {
next()
}
return
})
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。