feat: update vc-menu

pull/309/head
tangjinzhou 2018-11-06 11:59:01 +08:00
parent 4d86a61e4d
commit 4d206886c5
4 changed files with 10 additions and 7 deletions

View File

@ -286,7 +286,7 @@ const DOMWrap = {
const tagProps = {
on: this.$listeners,
}
return <Tag {...tagProps}>{this.renderChildren(filterEmpty(this.$slots.default))}</Tag>
return <Tag {...tagProps}>{this.renderChildren(this.$slots.default)}</Tag>
},
}

View File

@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types'
import { Provider, create } from '../_util/store'
import { default as SubPopupMenu, getActiveKey } from './SubPopupMenu'
import BaseMixin from '../_util/BaseMixin'
import hasProp, { getOptionProps, getComponentFromProp } from '../_util/props-util'
import hasProp, { getOptionProps, getComponentFromProp, filterEmpty } from '../_util/props-util'
import commonPropsType from './commonPropsType'
const Menu = {
@ -161,7 +161,7 @@ const Menu = {
overflowedIndicator: getComponentFromProp(this, 'overflowedIndicator', props),
openTransitionName: this.getOpenTransitionName(),
parentMenu: this,
children: this.$slots.default || [],
children: filterEmpty(this.$slots.default || []),
},
class: `${props.prefixCls}-root`,
on: {

View File

@ -6,7 +6,7 @@ import { connect } from '../_util/store'
import SubPopupMenu from './SubPopupMenu'
import placements from './placements'
import BaseMixin from '../_util/BaseMixin'
import { getComponentFromProp } from '../_util/props-util'
import { getComponentFromProp, filterEmpty } from '../_util/props-util'
import { requestAnimationTimeout, cancelAnimationTimeout } from '../_util/requestAnimationTimeout'
import {
noop,
@ -491,7 +491,7 @@ const SubMenu = {
{icon || <i class={`${prefixCls}-arrow`} />}
</div>
)
const children = this.renderChildren(this.$slots.default)
const children = this.renderChildren(filterEmpty(this.$slots.default))
const getPopupContainer = this.parentMenu.isRootMenu
? this.parentMenu.getPopupContainer : triggerNode => triggerNode.parentNode

View File

@ -336,7 +336,7 @@ const SubPopupMenu = {
},
render () {
const { ...props } = this.$props
const { eventKey, visible, level, mode, theme } = props
const { eventKey, prefixCls, visible, level, mode, theme } = props
this.instanceArray = []
this.instanceArrayKeyIndexMap = {}
const className = classNames(
@ -348,7 +348,10 @@ const SubPopupMenu = {
tag: 'ul',
// hiddenClassName: `${prefixCls}-hidden`,
visible,
level, mode, theme,
prefixCls,
level,
mode,
theme,
overflowedIndicator: getComponentFromProp(this, 'overflowedIndicator'),
},
attrs: {