fix: do not show dropdown if only one option
(cherry picked from commit f0bf6962e7b0f5d3932fa26370be94b134a37724)
This commit is contained in:
parent
61ba3bd7f9
commit
d32d6e62fb
@ -2,10 +2,13 @@
|
|||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<Button
|
<Button
|
||||||
variant="solid"
|
variant="solid"
|
||||||
class="border-0 rounded-br-none rounded-tr-none"
|
class="border-0"
|
||||||
:label="activeButton.label"
|
:label="activeButton.label"
|
||||||
:size="$attrs.size"
|
:size="$attrs.size"
|
||||||
:class="$attrs.class"
|
:class="[
|
||||||
|
$attrs.class,
|
||||||
|
showDropdown ? 'rounded-br-none rounded-tr-none' : '',
|
||||||
|
]"
|
||||||
@click="() => activeButton.onClick()"
|
@click="() => activeButton.onClick()"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
@ -17,6 +20,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
v-show="showDropdown"
|
||||||
:options="parsedOptions"
|
:options="parsedOptions"
|
||||||
size="sm"
|
size="sm"
|
||||||
class="flex-1 [&>div>div>div]:w-full"
|
class="flex-1 [&>div>div>div]:w-full"
|
||||||
@ -44,6 +48,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const showDropdown = ref(props.options?.length > 1)
|
||||||
const activeButton = ref(props.options?.[0] || {})
|
const activeButton = ref(props.options?.[0] || {})
|
||||||
|
|
||||||
const parsedOptions = computed(() => {
|
const parsedOptions = computed(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user