|
|
@ -1,14 +1,14 @@ |
|
|
<template> |
|
|
<template> |
|
|
<Menu.Item :key="itemKey"> |
|
|
<Menu.Item :key="itemKey"> |
|
|
<span class="flex items-center"> |
|
|
<span class="flex items-center"> |
|
|
<Icon :icon="icon" class="mr-1" /> |
|
|
<Icon :icon="props.icon" class="mr-1" /> |
|
|
<span>{{ text }}</span> |
|
|
<span>{{ props.text }}</span> |
|
|
</span> |
|
|
</span> |
|
|
</Menu.Item> |
|
|
</Menu.Item> |
|
|
</template> |
|
|
</template> |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { Menu } from 'ant-design-vue'; |
|
|
import { Menu } from 'ant-design-vue'; |
|
|
import { computed, getCurrentInstance } from 'vue'; |
|
|
import { computed, getCurrentInstance, useAttrs } from 'vue'; |
|
|
import Icon from '@/components/Icon/Icon.vue'; |
|
|
import Icon from '@/components/Icon/Icon.vue'; |
|
|
import { propTypes } from '@/utils/propTypes'; |
|
|
import { propTypes } from '@/utils/propTypes'; |
|
|
|
|
|
|
|
|
@ -16,11 +16,14 @@ |
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
// eslint-disable-next-line |
|
|
// eslint-disable-next-line |
|
|
key: propTypes.string, |
|
|
|
|
|
text: propTypes.string, |
|
|
text: propTypes.string, |
|
|
icon: propTypes.string, |
|
|
icon: propTypes.string, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const attrs = useAttrs(); |
|
|
|
|
|
|
|
|
const instance = getCurrentInstance(); |
|
|
const instance = getCurrentInstance(); |
|
|
const itemKey = computed(() => props.key || instance?.vnode?.props?.key); |
|
|
const itemKey = computed( |
|
|
|
|
|
() => (attrs.key || instance?.vnode?.props?.key) as string | number | undefined, |
|
|
|
|
|
); |
|
|
</script> |
|
|
</script> |
|
|
|