mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-04-30 22:29:01 +08:00
fix: withPermission完善
This commit is contained in:
parent
2ff0befdd4
commit
43506681e9
@ -2,13 +2,8 @@ import { permission } from '@/directives'
|
|||||||
/**
|
/**
|
||||||
* @description: 按钮权限渲染
|
* @description: 按钮权限渲染
|
||||||
*/
|
*/
|
||||||
import { h, withDirectives } from 'vue'
|
import { withDirectives } from 'vue'
|
||||||
|
|
||||||
export function PH(el, props, slots, butCode) {
|
export function withPermission(vnode, code) {
|
||||||
return withDirectives(
|
return withDirectives(vnode, [[permission, code]])
|
||||||
h(el, props, slots),
|
|
||||||
[
|
|
||||||
[permission, butCode],
|
|
||||||
],
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { MeCrud, MeModal, MeQueryItem } from '@/components'
|
import { MeCrud, MeModal, MeQueryItem } from '@/components'
|
||||||
import { useCrud } from '@/composables'
|
import { useCrud } from '@/composables'
|
||||||
import { formatDateTime, PH } from '@/utils'
|
import { formatDateTime, withPermission } from '@/utils'
|
||||||
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
|
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
|
||||||
import api from './api'
|
import api from './api'
|
||||||
|
|
||||||
@ -225,18 +225,16 @@ const columns = [
|
|||||||
hideInExcel: true,
|
hideInExcel: true,
|
||||||
render(row) {
|
render(row) {
|
||||||
return [
|
return [
|
||||||
PH(
|
withPermission(
|
||||||
NButton,
|
h(NButton, {
|
||||||
{
|
|
||||||
size: 'small',
|
size: 'small',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
secondary: true,
|
secondary: true,
|
||||||
onClick: () => handleOpenRolesSet(row),
|
onClick: () => handleOpenRolesSet(row),
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
default: () => '超管专属',
|
default: () => '超管专属',
|
||||||
icon: () => h('i', { class: 'i-carbon:user-role text-14' }),
|
icon: () => h('i', { class: 'i-carbon:user-role text-14' }),
|
||||||
},
|
}),
|
||||||
'superAdmin',
|
'superAdmin',
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user