import { defineComponent, computed, unref } from 'vue'; import { Dropdown, Menu } from 'ant-design-vue'; import Icon from '/@/components/Icon/index'; import { basicDropdownProps } from './props'; import { getSlot } from '/@/utils/helper/tsxHelper'; export default defineComponent({ name: 'Dropdown', props: basicDropdownProps, setup(props, { slots, emit, attrs }) { const getMenuList = computed(() => props.dropMenuList); function handleClickMenu({ key }: any) { const menu = unref(getMenuList)[key]; emit('menuEvent', menu); } function renderMenus() { return ( {() => ( <> {unref(getMenuList).map((item, index) => { const { disabled, icon, text, divider } = item; return [ {() => ( <> {icon && } {text} )} , // @ts-ignore divider && , ]; })} )} ); } return () => ( {{ default: () => {getSlot(slots)}, overlay: () => renderMenus(), }} ); }, });