-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSubPopupMenu.jsx
61 lines (51 loc) · 1.36 KB
/
SubPopupMenu.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import MenuMixin from './MenuMixin'
import BaseMixin from '../_util/BaseMixin'
import commonPropsType from './commonPropsType'
export default {
name: 'SubPopupMenu',
props: { ...commonPropsType,
},
mixins: [MenuMixin, BaseMixin],
methods: {
onDeselect (selectInfo) {
this.__emit('deselect', selectInfo)
},
onSelect (selectInfo) {
this.__emit('select', selectInfo)
},
onClick (e) {
this.__emit('click', e)
},
onOpenChange (e) {
this.__emit('openChange', e)
},
onDestroy (key) {
this.__emit('destroy', key)
},
getOpenTransitionName () {
return this.$props.openTransitionName
},
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)
},
},
render () {
const props = this.$props
this.haveOpened = this.haveOpened || props.visible || props.forceSubMenuRender
if (!this.haveOpened) {
return null
}
const { prefixCls } = this.$props
return this.renderRoot({ ...this.$props, class: `${prefixCls}-sub` }, this.$slots.default)
},
}