mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-15 03:06:25 +08:00

* feat(components): [segmented] new component * feat(components): [segmented] * feat(components): update * feat(components): update * feat(theme-chalk): update * feat(components): update * feat: update * feat: update * feat(components): add focus-visible * feat(theme-chalk): update * feat(components): fix test * docs: docs * feat(components): update * feat: add icon
61 lines
1000 B
Vue
61 lines
1000 B
Vue
<template>
|
|
<div>
|
|
<el-segmented v-model="value" :options="options">
|
|
<template #default="{ item }">
|
|
<div class="flex flex-col items-center gap-2 p-2">
|
|
<el-icon size="20">
|
|
<component :is="item.icon" />
|
|
</el-icon>
|
|
<div>{{ item.label }}</div>
|
|
</div>
|
|
</template>
|
|
</el-segmented>
|
|
</div>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
import {
|
|
Apple,
|
|
Cherry,
|
|
Grape,
|
|
Orange,
|
|
Pear,
|
|
Watermelon,
|
|
} from '@element-plus/icons-vue'
|
|
|
|
const value = ref('Apple')
|
|
|
|
const options = [
|
|
{
|
|
label: 'Apple',
|
|
value: 'Apple',
|
|
icon: Apple,
|
|
},
|
|
{
|
|
label: 'Cherry',
|
|
value: 'Cherry',
|
|
icon: Cherry,
|
|
},
|
|
{
|
|
label: 'Grape',
|
|
value: 'Grape',
|
|
icon: Grape,
|
|
},
|
|
{
|
|
label: 'Orange',
|
|
value: 'Orange',
|
|
icon: Orange,
|
|
},
|
|
{
|
|
label: 'Pear',
|
|
value: 'Pear',
|
|
icon: Pear,
|
|
},
|
|
{
|
|
label: 'Watermelon',
|
|
value: 'Watermelon',
|
|
icon: Watermelon,
|
|
},
|
|
]
|
|
</script>
|