13/7/1404
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<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 _loading = computed(() => {
|
||||
if (props.loading){
|
||||
return 'flex'
|
||||
} else return 'unset'
|
||||
})
|
||||
const { prefixCls } = usePrefix('base-button')
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
iconSize: baseButtonIconSize,
|
||||
// iconLeft: false,
|
||||
iconClass: ''
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@prefix:~'@{prefixCls}-base-button';
|
||||
.@{prefix}{
|
||||
//width: fit-content;
|
||||
height: auto;
|
||||
/*padding: 8px;*/
|
||||
display: v-bind(_loading);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user