1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-04-30 22:29:01 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
leip247
10ae8ace90
Merge 43506681e9ce55d5655a3a7c8d12e9fd5bb17f70 into 70c2098d2ed646348812945873349e4e72080186 2025-03-21 03:29:42 +00:00
leipu
43506681e9 fix: withPermission完善 2025-03-21 11:29:28 +08:00
2 changed files with 8 additions and 15 deletions

View File

@ -2,13 +2,8 @@ import { permission } from '@/directives'
/**
* @description: 按钮权限渲染
*/
import { h, withDirectives } from 'vue'
import { withDirectives } from 'vue'
export function PH(el, props, slots, butCode) {
return withDirectives(
h(el, props, slots),
[
[permission, butCode],
],
)
export function withPermission(vnode, code) {
return withDirectives(vnode, [[permission, code]])
}

View File

@ -112,7 +112,7 @@
<script setup>
import { MeCrud, MeModal, MeQueryItem } from '@/components'
import { useCrud } from '@/composables'
import { formatDateTime, PH } from '@/utils'
import { formatDateTime, withPermission } from '@/utils'
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
import api from './api'
@ -225,18 +225,16 @@ const columns = [
hideInExcel: true,
render(row) {
return [
PH(
NButton,
{
withPermission(
h(NButton, {
size: 'small',
type: 'primary',
secondary: true,
onClick: () => handleOpenRolesSet(row),
},
{
}, {
default: () => '超管专属',
icon: () => h('i', { class: 'i-carbon:user-role text-14' }),
},
}),
'superAdmin',
),
h(