ant-design-vue/components/vc-menu/SubPopupMenu.vue

62 lines
1.4 KiB
Vue
Raw Normal View History

2017-12-29 10:45:11 +00:00
<script>
2017-12-08 06:31:53 +00:00
import MenuMixin from './MenuMixin'
2018-02-06 09:22:36 +00:00
import BaseMixin from '../_util/BaseMixin'
2018-01-04 11:06:54 +00:00
import commonPropsType from './commonPropsType'
2017-12-29 10:45:11 +00:00
export default {
name: 'SubPopupMenu',
2018-01-04 11:06:54 +00:00
props: { ...commonPropsType,
2017-12-08 06:31:53 +00:00
},
2018-01-12 08:10:41 +00:00
mixins: [MenuMixin, BaseMixin],
2018-01-03 10:30:12 +00:00
methods: {
onDeselect (selectInfo) {
2018-01-12 08:10:41 +00:00
this.__emit('deselect', selectInfo)
2018-01-03 10:30:12 +00:00
},
2017-12-08 06:31:53 +00:00
2018-01-03 10:30:12 +00:00
onSelect (selectInfo) {
2018-01-12 08:10:41 +00:00
this.__emit('select', selectInfo)
2018-01-03 10:30:12 +00:00
},
2017-12-08 06:31:53 +00:00
2018-01-03 10:30:12 +00:00
onClick (e) {
2018-01-12 08:10:41 +00:00
this.__emit('click', e)
2018-01-03 10:30:12 +00:00
},
2017-12-08 06:31:53 +00:00
2018-01-03 10:30:12 +00:00
onOpenChange (e) {
2018-01-12 08:10:41 +00:00
this.__emit('openChange', e)
2018-01-03 10:30:12 +00:00
},
2017-12-08 06:31:53 +00:00
2018-01-03 10:30:12 +00:00
onDestroy (key) {
2018-01-12 08:10:41 +00:00
this.__emit('destroy', key)
2018-01-03 10:30:12 +00:00
},
2017-12-08 06:31:53 +00:00
2018-01-03 10:30:12 +00:00
getOpenTransitionName () {
return this.$props.openTransitionName
},
2017-12-08 06:31:53 +00:00
2018-01-03 10:30:12 +00:00
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)
},
2017-12-08 06:31:53 +00:00
},
render () {
2018-01-19 10:18:17 +00:00
const props = this.$props
this.haveOpened = this.haveOpened || props.visible || props.forceSubMenuRender
if (!this.haveOpened) {
return null
}
2018-01-04 11:06:54 +00:00
const { prefixCls } = this.$props
return this.renderRoot({ ...this.$props, class: `${prefixCls}-sub` }, this.$slots.default)
2017-12-08 06:31:53 +00:00
},
2017-12-29 10:45:11 +00:00
}
</script>