2020-12-15 00:13:23 +08:00
|
|
|
<template>
|
2021-06-27 15:33:30 +08:00
|
|
|
<MenuItem :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>
|
|
|
|
|
</MenuItem>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts">
|
2021-02-19 22:15:02 +08:00
|
|
|
import { Menu } from 'ant-design-vue';
|
2020-12-15 00:13:23 +08:00
|
|
|
|
2021-06-27 15:33:30 +08:00
|
|
|
import { computed, defineComponent, getCurrentInstance } from 'vue';
|
2020-12-15 00:13:23 +08:00
|
|
|
|
|
|
|
|
import Icon from '/@/components/Icon/index';
|
|
|
|
|
import { propTypes } from '/@/utils/propTypes';
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'DropdownMenuItem',
|
2021-02-19 22:15:02 +08:00
|
|
|
components: { MenuItem: Menu.Item, Icon },
|
2020-12-15 00:13:23 +08:00
|
|
|
props: {
|
|
|
|
|
key: propTypes.string,
|
|
|
|
|
text: propTypes.string,
|
|
|
|
|
icon: propTypes.string,
|
|
|
|
|
},
|
2021-06-27 15:33:30 +08:00
|
|
|
setup(props) {
|
|
|
|
|
const instance = getCurrentInstance();
|
|
|
|
|
const itemKey = computed(() => props.key || instance?.vnode?.props?.key);
|
|
|
|
|
return { itemKey };
|
|
|
|
|
},
|
2020-12-15 00:13:23 +08:00
|
|
|
});
|
|
|
|
|
</script>
|