Files
JeecgBoot/jeecgboot-vue3/src/layouts/default/header/components/user-dropdown/DropMenuItem.vue
2025-11-26 11:25:35 +08:00

34 lines
964 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<MenuItem :key="itemKey">
<span class="flex items-center">
<Icon :icon="icon" class="mr-1" />
<span>{{ text }}</span>
</span>
</MenuItem>
</template>
<script lang="ts">
import { Menu } from 'ant-design-vue';
import { computed, defineComponent, getCurrentInstance } from 'vue';
import Icon from '/@/components/Icon/index';
import { propTypes } from '/@/utils/propTypes';
export default defineComponent({
name: 'DropdownMenuItem',
components: { MenuItem: Menu.Item, Icon },
props: {
// 【issues/6855】
itemKey: propTypes.string,
text: propTypes.string,
icon: propTypes.string,
},
setup(props) {
const instance = getCurrentInstance();
// 代码逻辑说明: 【issues/6855】组件使用key作props报警告改为itemKey
const itemKey = computed(() => props.itemKey || instance?.vnode?.props?.itemKey);
return { itemKey };
},
});
</script>