Skip to content

Commit cbe373c

Browse files
committed
添加单选按钮组示例
1 parent 85e67c4 commit cbe373c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/views/component_built_in_example/button.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ meta:
33
enabled: false
44
</route>
55

6+
<script setup lang="ts">
7+
const hand = ref<'peace' | 'rock' | 'paper'>('peace')
8+
</script>
9+
610
<template>
711
<div>
812
<FaPageHeader title="按钮" description="FaButton" />
@@ -64,6 +68,20 @@ meta:
6468
删除
6569
</FaButton>
6670
</FaButtonGroup>
71+
<div class="flex flex-col gap-2">
72+
<div>单选按钮组</div>
73+
<FaButtonGroup class="gap-0 space-x-[-1px]">
74+
<FaButton :variant="hand === 'peace' ? 'default' : 'outline'" size="icon" :class="{ 'z-1': hand === 'peace' }" @click="hand = 'peace'">
75+
<FaIcon name="i-fa-regular:hand-peace" class="size-4" />
76+
</FaButton>
77+
<FaButton :variant="hand === 'rock' ? 'default' : 'outline'" size="icon" :class="{ 'z-1': hand === 'rock' }" @click="hand = 'rock'">
78+
<FaIcon name="i-fa-regular:hand-rock" class="size-4" />
79+
</FaButton>
80+
<FaButton :variant="hand === 'paper' ? 'default' : 'outline'" size="icon" :class="{ 'z-1': hand === 'paper' }" @click="hand = 'paper'">
81+
<FaIcon name="i-fa-regular:hand-paper" class="size-4" />
82+
</FaButton>
83+
</FaButtonGroup>
84+
</div>
6785
</div>
6886
</FaPageMain>
6987
</div>

0 commit comments

Comments
 (0)