mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-07-09 00:00:04 +08:00
18 lines
469 B
JavaScript
18 lines
469 B
JavaScript
|
|
const hasPermission = {
|
|
install(app) {
|
|
app.directive('permission', {
|
|
beforeMount(el, binding) {
|
|
if (binding.value) {
|
|
const permissionList = app.config.globalProperties.$global.user.authorities
|
|
if (permissionList && permissionList.length && !permissionList.includes(binding.value) && import.meta.env.MODE != 'demo') {
|
|
el.style.display = 'none'
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
export default hasPermission
|