fix: 修复权限按钮组件
This commit is contained in:
parent
9f0e384be6
commit
6abc69e1d8
|
@ -4,25 +4,50 @@
|
|||
<a-popconfirm v-bind="popConfirm" :disabled="!isPermission || props.disabled">
|
||||
<a-tooltip v-if="tooltip" v-bind="tooltip">
|
||||
<slot v-if="noButton"></slot>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission"></a-button>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission">
|
||||
<slot></slot>
|
||||
<template #icon>
|
||||
<slot name="icon"></slot>
|
||||
</template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission"></a-button>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission">
|
||||
<slot></slot>
|
||||
<template #icon>
|
||||
<slot name="icon"></slot>
|
||||
</template>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<template v-else-if="tooltip">
|
||||
<a-tooltip v-bind="tooltip">
|
||||
<slot v-if="noButton"></slot>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission"></a-button>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission">
|
||||
<slot></slot>
|
||||
<template #icon>
|
||||
<slot name="icon"></slot>
|
||||
</template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-else>
|
||||
<slot v-if="noButton"></slot>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission"></a-button>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission">
|
||||
<slot></slot>
|
||||
<template #icon>
|
||||
<slot name="icon"></slot>
|
||||
</template>
|
||||
</a-button>
|
||||
</template>
|
||||
</template>
|
||||
<a-tooltip v-else title="没有权限">
|
||||
<slot v-if="noButton"></slot>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission"></a-button>
|
||||
<a-button v-else v-bind="buttonProps" :disabled="_isPermission">
|
||||
<slot></slot>
|
||||
<template #icon>
|
||||
<slot name="icon"></slot>
|
||||
</template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<script setup lang="ts" name="PermissionButton">
|
||||
|
@ -49,13 +74,13 @@ const isPermission = computed(() => {
|
|||
return permissionStore.hasPermission(props.hasPermission)
|
||||
})
|
||||
const _isPermission = computed(() =>
|
||||
'hasPermission' in props && isPermission
|
||||
'hasPermission' in props && isPermission.value
|
||||
? 'disabled' in buttonProps
|
||||
? buttonProps.disabled
|
||||
: false
|
||||
: true
|
||||
)
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue