DropMenuItem.vue 733 B

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