vue-vben-admin/src/layouts/default/header/components/user-dropdown/DropMenuItem.vue

27 lines
733 B
Vue
Raw Normal View History

2020-12-15 00:13:23 +08:00
<template>
<Menu.Item :key="itemKey">
2020-12-15 00:13:23 +08:00
<span class="flex items-center">
<Icon :icon="icon" class="mr-1" />
<span>{{ text }}</span>
</span>
</Menu.Item>
2020-12-15 00:13:23 +08:00
</template>
<script lang="ts" setup>
2021-02-19 22:15:02 +08:00
import { Menu } from 'ant-design-vue';
import { computed, getCurrentInstance } from 'vue';
2023-04-06 23:16:15 +08:00
import Icon from '@/components/Icon/Icon.vue';
import { propTypes } from '@/utils/propTypes';
2020-12-15 00:13:23 +08:00
defineOptions({ name: 'DropdownMenuItem' });
2020-12-15 00:13:23 +08:00
const props = defineProps({
// eslint-disable-next-line
key: propTypes.string,
text: propTypes.string,
icon: propTypes.string,
2020-12-15 00:13:23 +08:00
});
const instance = getCurrentInstance();
const itemKey = computed(() => props.key || instance?.vnode?.props?.key);
2020-12-15 00:13:23 +08:00
</script>