feat: 新增 FaButtonGroup 组件

This commit is contained in:
Hooray
2025-06-07 16:54:28 +08:00
parent 5160da3085
commit e553fefffb
3 changed files with 62 additions and 3 deletions
+60
View File
@@ -0,0 +1,60 @@
<script setup lang="ts">
import { cn } from '@/utils'
defineOptions({
name: 'FaButtonGroup',
})
const props = defineProps<{
vertical?: boolean
}>()
</script>
<template>
<div
:class="cn('inline-flex gap-[1px] items-stretch', {
'horizontal-group flex-row': !props.vertical,
'vertical-group flex-col': props.vertical,
})"
>
<slot />
</div>
</template>
<style scoped>
.horizontal-group {
:deep(> button) {
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
&:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
&:not(:first-child, :last-child) {
border-radius: 0;
}
}
}
.vertical-group {
:deep(> button) {
&:first-child {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
&:last-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
&:not(:first-child, :last-child) {
border-radius: 0;
}
}
}
</style>