Files
wechat-article-exporter/components/ButtonGroup.vue
2025-10-30 21:42:03 +08:00

33 lines
594 B
Vue

<template>
<UDropdown :items="items" :popper="{ placement: 'bottom-start' }">
<slot>
<UButton color="white" label="导出" trailing-icon="i-heroicons-chevron-down-20-solid" />
</slot>
</UDropdown>
</template>
<script setup lang="ts">
const emit = defineEmits();
interface Item {
label: string;
event: string;
disabled?: boolean;
}
interface Props {
items: Item[];
}
const props = defineProps<Props>();
const items = [
props.items.map(item => ({
label: item.label,
click() {
emit(item.event);
},
disabled: item.disabled,
})),
];
</script>