You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/menu/SubMenu.jsx

37 lines
933 B

import { inject } from 'vue';
import { SubMenu as VcSubMenu } from '../vc-menu';
import classNames from 'classnames';
import Omit from 'omit.js';
import { getSlot } from '../_util/props-util';
export default {
name: 'ASubMenu',
isSubMenu: true,
inheritAttrs: false,
props: { ...VcSubMenu.props },
setup() {
return {
menuPropsContext: inject('menuPropsContext', {}),
};
},
methods: {
onKeyDown(e) {
this.$refs.subMenu.onKeyDown(e);
},
},
render() {
const { $slots, $attrs } = this;
const { rootPrefixCls, popupClassName } = this.$props;
const { theme: antdMenuTheme } = this.menuPropsContext;
const props = {
...this.$props,
popupClassName: classNames(`${rootPrefixCls}-${antdMenuTheme}`, popupClassName),
ref: 'subMenu',
...$attrs,
...Omit($slots, ['default']),
};
return <VcSubMenu {...props}>{getSlot(this)}</VcSubMenu>;
},
};