办学质量监测教学评价系统
shenrongliang
2025-06-13 11d86cc6c26bb4f709e407acadf4805c2024e79f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<script lang="ts" setup>
import { cn } from '@vben-core/shared/utils';
 
defineOptions({ name: 'VbenButtonGroup' });
 
withDefaults(
  defineProps<{
    border?: boolean;
    gap?: number;
    size?: 'large' | 'middle' | 'small';
  }>(),
  { border: false, gap: 0, size: 'middle' },
);
</script>
<template>
  <div
    :class="
      cn(
        'vben-button-group rounded-md',
        `size-${size}`,
        gap ? 'with-gap' : 'no-gap',
        $attrs.class as string,
      )
    "
    :style="{ gap: gap ? `${gap}px` : '0px' }"
  >
    <slot></slot>
  </div>
</template>
 
<style lang="scss" scoped>
.vben-button-group {
  display: inline-flex;
 
  &.size-large :deep(button) {
    height: 2.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
 
    .icon-wrapper {
      margin-right: 0.4rem;
 
      svg {
        width: 1rem;
        height: 1rem;
      }
    }
  }
 
  &.size-middle :deep(button) {
    height: 2rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1rem;
 
    .icon-wrapper {
      margin-right: 0.2rem;
 
      svg {
        width: 0.75rem;
        height: 0.75rem;
      }
    }
  }
 
  &.size-small :deep(button) {
    height: 1.75rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.65rem;
    line-height: 0.75rem;
 
    .icon-wrapper {
      margin-right: 0.1rem;
 
      svg {
        width: 0.65rem;
        height: 0.65rem;
      }
    }
  }
 
  &.no-gap > :deep(button):nth-of-type(1) {
    border-radius: calc(var(--radius) - 2px) 0 0 calc(var(--radius) - 2px);
  }
 
  &.no-gap > :deep(button):last-of-type {
    border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0;
  }
 
  &.no-gap {
    :deep(button + button) {
      border-left-width: 0;
      border-radius: 0;
    }
  }
}
</style>