mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-20 15:01:46 +01:00
docs(select): update
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<script setup lang="ts">
|
||||
const items = ref([
|
||||
{
|
||||
label: 'bug',
|
||||
value: 'bug',
|
||||
chip: {
|
||||
color: 'red' as const
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'enhancement',
|
||||
value: 'enhancement',
|
||||
chip: {
|
||||
color: 'blue' as const
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'feature',
|
||||
value: 'feature',
|
||||
chip: {
|
||||
color: 'violet' as const
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
function getChip(value: string) {
|
||||
return items.value.find(item => item.value === value)?.chip
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<USelect default-value="bug" :items="items" class="w-40">
|
||||
<template #leading="{ modelValue, ui }">
|
||||
<UChip
|
||||
v-if="modelValue"
|
||||
v-bind="getChip(modelValue)"
|
||||
inset
|
||||
standalone
|
||||
:size="ui.itemLeadingChipSize()"
|
||||
:class="ui.itemLeadingChip()"
|
||||
/>
|
||||
</template>
|
||||
</USelect>
|
||||
</template>
|
||||
Reference in New Issue
Block a user