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.
46 lines
1.2 KiB
46 lines
1.2 KiB
7 years ago
|
<script>
|
||
7 years ago
|
import PropTypes from '../_util/vue-types'
|
||
|
import { getComponentFromProp } from '../_util/props-util'
|
||
7 years ago
|
|
||
|
const MenuItemGroup = {
|
||
|
name: 'MenuItemGroup',
|
||
|
|
||
|
props: {
|
||
|
renderMenuItem: PropTypes.func,
|
||
|
index: PropTypes.number,
|
||
|
className: PropTypes.string,
|
||
|
rootPrefixCls: PropTypes.string,
|
||
|
disabled: PropTypes.bool.def(true),
|
||
7 years ago
|
title: PropTypes.any,
|
||
7 years ago
|
},
|
||
7 years ago
|
isMenuItemGroup: true,
|
||
7 years ago
|
methods: {
|
||
|
renderInnerMenuItem (item, subIndex) {
|
||
|
const { renderMenuItem, index } = this.$props
|
||
|
return renderMenuItem(item, index, subIndex)
|
||
|
},
|
||
|
},
|
||
|
render () {
|
||
|
const props = this.$props
|
||
|
const { rootPrefixCls } = props
|
||
|
const titleClassName = `${rootPrefixCls}-item-group-title`
|
||
|
const listClassName = `${rootPrefixCls}-item-group-list`
|
||
|
return (
|
||
|
<li class={`${rootPrefixCls}-item-group`}>
|
||
|
<div
|
||
|
class={titleClassName}
|
||
|
title={typeof props.title === 'string' ? props.title : undefined}
|
||
|
>
|
||
7 years ago
|
{getComponentFromProp(this, 'title')}
|
||
7 years ago
|
</div>
|
||
|
<ul class={listClassName}>
|
||
|
{this.$slots.default.map(this.renderInnerMenuItem)}
|
||
|
</ul>
|
||
|
</li>
|
||
|
)
|
||
|
},
|
||
|
}
|
||
|
|
||
|
export default MenuItemGroup
|
||
|
</script>
|