This commit is contained in:
tangjinzhou 2018-01-19 18:18:17 +08:00
parent e8daeb3f26
commit 90fd428942
4 changed files with 15 additions and 7 deletions

View File

@ -8,10 +8,12 @@ import warning from '../_util/warning'
import Item from './MenuItem'
import { hasProp } from '../_util/props-util'
import BaseMixin from '../_util/BaseMixin'
import commonPropsType from './src/commonPropsType'
export const MenuMode = PropTypes.oneOf(['vertical', 'vertical-left', 'vertical-right', 'horizontal', 'inline'])
export const menuProps = {
...commonPropsType,
theme: PropTypes.oneOf(['light', 'dark']).def('light'),
mode: MenuMode.def('vertical'),
selectable: PropTypes.bool,

View File

@ -8,11 +8,8 @@ import commonPropsType from './commonPropsType'
const Menu = {
name: 'Menu',
props: {
getPopupContainer: PropTypes.func,
openTransitionName: PropTypes.string,
forceSubMenuRender: PropTypes.bool,
selectable: PropTypes.bool.def(true),
...commonPropsType,
selectable: PropTypes.bool.def(true),
},
mixins: [BaseMixin, MenuMixin],

View File

@ -1,9 +1,9 @@
<script>
import PropTypes from '../../_util/vue-types'
// import PropTypes from '../../_util/vue-types'
import MenuMixin from './MenuMixin'
import BaseMixin from '../../_util/BaseMixin'
import commonPropsType from './commonPropsType'
import { noop } from './util'
// import { noop } from './util'
export default {
name: 'SubPopupMenu',
props: { ...commonPropsType,
@ -51,6 +51,12 @@ export default {
},
},
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)
},

View File

@ -13,10 +13,13 @@ export default {
openAnimation: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
mode: PropTypes.oneOf(['horizontal', 'vertical', 'vertical-left', 'vertical-right', 'inline']).def('vertical'),
triggerSubMenuAction: PropTypes.string.def('hover'),
openTransitionName: PropTypes.string,
subMenuOpenDelay: PropTypes.number.def(0.1),
subMenuCloseDelay: PropTypes.number.def(0.1),
level: PropTypes.number.def(1),
inlineIndent: PropTypes.number.def(24),
theme: PropTypes.oneOf(['light', 'dark']).def('light'),
getPopupContainer: PropTypes.func,
openTransitionName: PropTypes.string,
forceSubMenuRender: PropTypes.bool,
selectable: PropTypes.bool,
}