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 = { const tagProps = {
on: this.$listeners, 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 { Provider, create } from '../_util/store'
import { default as SubPopupMenu, getActiveKey } from './SubPopupMenu' import { default as SubPopupMenu, getActiveKey } from './SubPopupMenu'
import BaseMixin from '../_util/BaseMixin' 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' import commonPropsType from './commonPropsType'
const Menu = { const Menu = {
@ -161,7 +161,7 @@ const Menu = {
overflowedIndicator: getComponentFromProp(this, 'overflowedIndicator', props), overflowedIndicator: getComponentFromProp(this, 'overflowedIndicator', props),
openTransitionName: this.getOpenTransitionName(), openTransitionName: this.getOpenTransitionName(),
parentMenu: this, parentMenu: this,
children: this.$slots.default || [], children: filterEmpty(this.$slots.default || []),
}, },
class: `${props.prefixCls}-root`, class: `${props.prefixCls}-root`,
on: { on: {

View File

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

View File

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