mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-05-01 14:49:00 +08:00
Compare commits
1 Commits
10ae8ace90
...
f482f9c741
Author | SHA1 | Date | |
---|---|---|---|
|
f482f9c741 |
@ -2,8 +2,13 @@ import { permission } from '@/directives'
|
|||||||
/**
|
/**
|
||||||
* @description: 按钮权限渲染
|
* @description: 按钮权限渲染
|
||||||
*/
|
*/
|
||||||
import { withDirectives } from 'vue'
|
import { h, withDirectives } from 'vue'
|
||||||
|
|
||||||
export function withPermission(vnode, code) {
|
export function PH(el, props, slots, butCode) {
|
||||||
return withDirectives(vnode, [[permission, code]])
|
return withDirectives(
|
||||||
|
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, withPermission } from '@/utils'
|
import { formatDateTime, PH } 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,16 +225,18 @@ const columns = [
|
|||||||
hideInExcel: true,
|
hideInExcel: true,
|
||||||
render(row) {
|
render(row) {
|
||||||
return [
|
return [
|
||||||
withPermission(
|
PH(
|
||||||
h(NButton, {
|
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