This commit is contained in:
Your Name
2026-03-01 14:17:59 +08:00
parent 65aa12f146
commit a07e844c47
6071 changed files with 777651 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
/**
* perm 操作权限处理
* 指令用法:
* <el-button v-perms="['auth.menu/edit']">编辑</el-button>
*/
import useClipboard from 'vue-clipboard3'
import feedback from '@/utils/feedback'
const clipboard = 'data-clipboard-text'
export default {
mounted: (el: HTMLElement, binding: any) => {
el.setAttribute(clipboard, binding.value)
const { toClipboard } = useClipboard()
el.onclick = () => {
toClipboard(el.getAttribute(clipboard)!)
.then(() => {
feedback.msgSuccess('复制成功')
})
.catch(() => {
feedback.msgError('复制失败')
})
}
},
updated: (el: HTMLElement, binding: any) => {
el.setAttribute(clipboard, binding.value)
}
}
+29
View File
@@ -0,0 +1,29 @@
/**
* perm 操作权限处理
* 指令用法:
* <el-button v-perms="['auth.menu/edit']">编辑</el-button>
*/
import useUserStore from '@/stores/modules/user'
export default {
mounted: (el: HTMLElement, binding: any) => {
const { value } = binding
const userStore = useUserStore()
const permissions = userStore.perms
const all_permission = '*'
if (Array.isArray(value)) {
if (value.length > 0) {
const hasPermission = permissions.some((key: string) => {
return all_permission == key || value.includes(key)
})
if (!hasPermission) {
el.parentNode && el.parentNode.removeChild(el)
}
}
} else {
throw new Error('like v-perms="[\'auth.menu/edit\']"')
}
}
}