Skip to content

Commit e553fef

Browse files
committed
feat: 新增 FaButtonGroup 组件
1 parent 5160da3 commit e553fef

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed

‎src/layouts/components/MainSidebar/index.vue‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ onUnmounted(() => {
4040
<component :is="useSlots('main-sidebar-top')" />
4141
<Logo :show-title="false" class="sidebar-logo" />
4242
<component :is="useSlots('main-sidebar-after-logo')" />
43-
<FaScrollArea :scrollbar="false" mask gradient-color="var(--g-main-sidebar-bg)" class="menu">
43+
<FaScrollArea :scrollbar="false" mask gradient-color="var(--g-main-sidebar-bg)" class="menu flex-1">
4444
<!-- 侧边栏模式(含主导航) -->
4545
<div class="w-full flex flex-col of-hidden py-1 transition-all -mt-2">
4646
<template v-for="(item, index) in menuStore.allMenus" :key="index">
@@ -92,8 +92,6 @@ onUnmounted(() => {
9292
}
9393
9494
.menu {
95-
flex: 1;
96-
9795
:deep(.menu-item) {
9896
.menu-item-container {
9997
padding-block: 8px;

‎src/types/components.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ declare module 'vue' {
1313
FaAvatar: typeof import('./../ui/components/FaAvatar/index.vue')['default']
1414
FaBackToTop: typeof import('./../ui/components/FaBackToTop/index.vue')['default']
1515
FaButton: typeof import('./../ui/components/FaButton/index.vue')['default']
16+
FaButtonGroup: typeof import('./../ui/components/FaButtonGroup/index.vue')['default']
1617
FaCard: typeof import('./../ui/components/FaCard/index.vue')['default']
1718
FaCheckbox: typeof import('./../ui/components/FaCheckbox/index.vue')['default']
1819
FaContextMenu: typeof import('./../ui/components/FaContextMenu/index.vue')['default']
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<script setup lang="ts">
2+
import { cn } from '@/utils'
3+
4+
defineOptions({
5+
name: 'FaButtonGroup',
6+
})
7+
8+
const props = defineProps<{
9+
vertical?: boolean
10+
}>()
11+
</script>
12+
13+
<template>
14+
<div
15+
:class="cn('inline-flex gap-[1px] items-stretch', {
16+
'horizontal-group flex-row': !props.vertical,
17+
'vertical-group flex-col': props.vertical,
18+
})"
19+
>
20+
<slot />
21+
</div>
22+
</template>
23+
24+
<style scoped>
25+
.horizontal-group {
26+
:deep(> button) {
27+
&:first-child {
28+
border-top-right-radius: 0;
29+
border-bottom-right-radius: 0;
30+
}
31+
32+
&:last-child {
33+
border-top-left-radius: 0;
34+
border-bottom-left-radius: 0;
35+
}
36+
37+
&:not(:first-child, :last-child) {
38+
border-radius: 0;
39+
}
40+
}
41+
}
42+
43+
.vertical-group {
44+
:deep(> button) {
45+
&:first-child {
46+
border-bottom-right-radius: 0;
47+
border-bottom-left-radius: 0;
48+
}
49+
50+
&:last-child {
51+
border-top-left-radius: 0;
52+
border-top-right-radius: 0;
53+
}
54+
55+
&:not(:first-child, :last-child) {
56+
border-radius: 0;
57+
}
58+
}
59+
}
60+
</style>

0 commit comments

Comments
 (0)