59 lines
1.3 KiB
Vue
59 lines
1.3 KiB
Vue
<template>
|
|
<AButton :disabled="props.disabledB" :type="props.type" :size="props.size" :class="[prefixCls, _class]" :loading="props.loading">
|
|
<!-- py-1 px-2-->
|
|
<div
|
|
class="flex items-center gap-1 justify-center flex-row-reverse gap-2 py-1 px-2"
|
|
:class="[{ 'flex-row-reverse': suffixIcon }]"
|
|
>
|
|
<slot v-if="$slots.default"></slot>
|
|
|
|
<Icon :size="iconSize" :icon="icon" v-if="icon" :class="iconClass" />
|
|
</div>
|
|
</AButton>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
// import { usePrefix } from '@core/composable/usePrefix'
|
|
import {usePrefix} from "@/utils/usePrefix";
|
|
import {computed, useSlots} from 'vue'
|
|
import {baseButtonIconSize} from "@/themeConfig";
|
|
import Icon from "@/components/BasicPacks/BasicIcon.vue";
|
|
|
|
interface Props {
|
|
icon?: string
|
|
iconSize?: string
|
|
iconClass?: string
|
|
suffixIcon?: boolean
|
|
type?: string
|
|
size?: string
|
|
loading?: boolean
|
|
disabledB?:boolean
|
|
|
|
// prefixIcon?: string
|
|
}
|
|
|
|
const slot = useSlots()
|
|
|
|
const _class = computed(() => {
|
|
if (!slot.default) {
|
|
return '!px-1 !py-1'
|
|
}
|
|
return ''
|
|
})
|
|
|
|
const { prefixCls } = usePrefix('base-button')
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
iconSize: baseButtonIconSize,
|
|
// iconLeft: false,
|
|
iconClass: ''
|
|
})
|
|
</script>
|
|
|
|
<style lang="less">
|
|
@prefix:~'@{prefixCls}-base-button';
|
|
.@{prefix}{
|
|
height: auto;
|
|
}
|
|
</style>
|