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