This commit is contained in:
sjl
2025-01-09 13:56:56 +08:00
parent 80d1912fd5
commit 5be1d22115
7 changed files with 120 additions and 45 deletions

View File

@@ -10,12 +10,14 @@ const auth: Directive = {
const { value } = binding
const authStore = useAuthStore()
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
// console.log('1234',authStore.routeName)
// console.log('123',currentPageRoles)
if (value instanceof Array && value.length) {
// console.log('1234',authStore.routeName)
// console.log('123',currentPageRoles)
if (value instanceof Array && value.length) {
console.log('123456',value)
const hasPermission = value.every(item => currentPageRoles.includes(item))
if (!hasPermission) el.remove()
} else {
console.log('12345',value)
if (!currentPageRoles.includes(value)) el.remove()
}
},