File size: 626 Bytes
6e41657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<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>