mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-05-01 14:49:00 +08:00
24 lines
628 B
JavaScript
24 lines
628 B
JavaScript
/**********************************
|
|
* @Author: Ronnie Zhang
|
|
* @LastEditor: Ronnie Zhang
|
|
* @LastEditTime: 2023/12/05 21:23:01
|
|
* @Email: zclzone@outlook.com
|
|
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
|
**********************************/
|
|
|
|
import { router } from '@/router'
|
|
|
|
export const permission = {
|
|
mounted(el, binding) {
|
|
const currentRoute = unref(router.currentRoute)
|
|
const btns = currentRoute.meta?.btns?.map(item => item.code) || []
|
|
if (!btns.includes(binding.value)) {
|
|
el.remove()
|
|
}
|
|
},
|
|
}
|
|
|
|
export function setupDirectives(app) {
|
|
app.directive('permission', permission)
|
|
}
|