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/vc-menu/SubPopupMenu.vue

62 lines
1.4 KiB

7 years ago
<script>
7 years ago
import MenuMixin from './MenuMixin'
7 years ago
import BaseMixin from '../_util/BaseMixin'
7 years ago
import commonPropsType from './commonPropsType'
7 years ago
export default {
name: 'SubPopupMenu',
7 years ago
props: { ...commonPropsType,
7 years ago
},
7 years ago
mixins: [MenuMixin, BaseMixin],
7 years ago
methods: {
onDeselect (selectInfo) {
7 years ago
this.__emit('deselect', selectInfo)
7 years ago
},
7 years ago
7 years ago
onSelect (selectInfo) {
7 years ago
this.__emit('select', selectInfo)
7 years ago
},
7 years ago
7 years ago
onClick (e) {
7 years ago
this.__emit('click', e)
7 years ago
},
7 years ago
7 years ago
onOpenChange (e) {
7 years ago
this.__emit('openChange', e)
7 years ago
},
7 years ago
7 years ago
onDestroy (key) {
7 years ago
this.__emit('destroy', key)
7 years ago
},
7 years ago
7 years ago
getOpenTransitionName () {
return this.$props.openTransitionName
},
7 years ago
7 years ago
renderMenuItem (c, i, subIndex) {
if (!c) {
return null
}
const props = this.$props
const extraProps = {
openKeys: props.openKeys,
selectedKeys: props.selectedKeys,
triggerSubMenuAction: props.triggerSubMenuAction,
isRootMenu: false,
}
return this.renderCommonMenuItem(c, i, subIndex, extraProps)
},
7 years ago
},
render () {
7 years ago
const props = this.$props
this.haveOpened = this.haveOpened || props.visible || props.forceSubMenuRender
if (!this.haveOpened) {
return null
}
7 years ago
const { prefixCls } = this.$props
return this.renderRoot({ ...this.$props, class: `${prefixCls}-sub` }, this.$slots.default)
7 years ago
},
7 years ago
}
</script>