Ben Lin
2024-07-06 44ef538691b8be0fd925ca80c49157bad14962e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<template>
  <Menu.Item :key="itemKey">
    <span class="flex items-center">
      <Icon :icon="icon" class="mr-1" />
      <span>{{ text }}</span>
    </span>
  </Menu.Item>
</template>
<script lang="ts" setup>
  import { Menu } from 'ant-design-vue';
  import { computed, getCurrentInstance } from 'vue';
  import Icon from '@/components/Icon/Icon.vue';
  import { propTypes } from '@/utils/propTypes';
 
  defineOptions({ name: 'DropdownMenuItem' });
 
  defineProps({
    text: propTypes.string,
    icon: propTypes.string,
  });
 
  const instance = getCurrentInstance();
  const itemKey = computed(() => instance?.vnode?.props?.key);
</script>