fix
parent
f9a85a6c41
commit
d9c893edb5
|
@ -18,7 +18,8 @@ const getOptionProps = (instance) => {
|
|||
return filterProps($props, $options.propsData)
|
||||
}
|
||||
|
||||
const getComponentFromProp = (instance, h, prop) => {
|
||||
const getComponentFromProp = (instance, prop) => {
|
||||
const h = instance.$createElement
|
||||
const temp = instance[prop]
|
||||
if (temp !== undefined) {
|
||||
return typeof temp === 'function' ? temp(h) : temp
|
||||
|
|
|
@ -3,11 +3,11 @@ import { Item, itemProps } from './src/index'
|
|||
import { getClass, getStyle } from '../_util/vnode'
|
||||
import Tooltip from '../tooltip'
|
||||
import { getComponentFromProp } from '../_util/props-util'
|
||||
|
||||
function noop () {}
|
||||
export default {
|
||||
props: itemProps,
|
||||
inject: {
|
||||
getInlineCollapsed: { default: () => { false } },
|
||||
getInlineCollapsed: { default: () => noop },
|
||||
},
|
||||
isMenuItem: 1,
|
||||
methods: {
|
||||
|
@ -28,6 +28,7 @@ export default {
|
|||
const toolTipProps = {
|
||||
props: {
|
||||
placement: 'right',
|
||||
trigger: 'click',
|
||||
overlayClassName: `${props.rootPrefixCls}-inline-collapsed-tooltip`,
|
||||
},
|
||||
on: {},
|
||||
|
@ -36,6 +37,7 @@ export default {
|
|||
{...toolTipProps}
|
||||
>
|
||||
<template slot='title'>
|
||||
jdjjdj
|
||||
{inlineCollapsed && props.level === 1 ? <span>$slots</span> : ''}
|
||||
</template>
|
||||
<Item {...itemProps} ref='menuItem'>
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
<AntButton type="primary" @click="toggleCollapsed" style="margin-bottom: 16px">
|
||||
<Icon :type="collapsed ? 'menu-unfold' : 'menu-fold'" />
|
||||
</AntButton>
|
||||
<MenuItem key="1">
|
||||
<Icon type="pie-chart" />
|
||||
<span>Option 1</span>
|
||||
</MenuItem>
|
||||
<Menu
|
||||
:defaultSelectedKeys="['1']"
|
||||
:defaultOpenKeys="['sub1']"
|
||||
|
@ -16,11 +20,11 @@
|
|||
theme="dark"
|
||||
:inlineCollapsed="collapsed"
|
||||
>
|
||||
<MenuItem key="1">
|
||||
<!-- <MenuItem key="1">
|
||||
<Icon type="pie-chart" />
|
||||
<span>Option 1</span>
|
||||
</MenuItem>
|
||||
<MenuItem key="2">
|
||||
</MenuItem> -->
|
||||
<!-- <MenuItem key="2">
|
||||
<Icon type="desktop" />
|
||||
<span>Option 2</span>
|
||||
</MenuItem>
|
||||
|
@ -47,7 +51,7 @@
|
|||
<MenuItem key="11">Option 11</MenuItem>
|
||||
<MenuItem key="12">Option 12</MenuItem>
|
||||
</SubMenu>
|
||||
</SubMenu>
|
||||
</SubMenu> -->
|
||||
</Menu>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -104,7 +104,7 @@ const MenuItem = {
|
|||
},
|
||||
|
||||
isSelected () {
|
||||
return this.$props.selectedKeys.indexOf(this.$props.eventKey) !== -1
|
||||
return this.$props.selectedKeys && this.$props.selectedKeys.indexOf(this.$props.eventKey) !== -1
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ export default {
|
|||
<div
|
||||
{...titleProps}
|
||||
>
|
||||
{getComponentFromProp(this, h, 'title')}
|
||||
{getComponentFromProp(this, 'title')}
|
||||
<i class={`${prefixCls}-arrow`} />
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -89,15 +89,15 @@ export default {
|
|||
<div class={`${prefixCls}-message`}>
|
||||
<Icon type='exclamation-circle' />
|
||||
<div class={`${prefixCls}-message-title`}>
|
||||
{getComponentFromProp(this, h, 'title')}
|
||||
{getComponentFromProp(this, 'title')}
|
||||
</div>
|
||||
</div>
|
||||
<div class={`${prefixCls}-buttons`}>
|
||||
<Button onClick={this.onCancel} size='small'>
|
||||
{getComponentFromProp(this, h, 'cancelText')}
|
||||
{getComponentFromProp(this, 'cancelText')}
|
||||
</Button>
|
||||
<Button onClick={this.onConfirm} type={okType} size='small'>
|
||||
{getComponentFromProp(this, h, 'okText')}
|
||||
{getComponentFromProp(this, 'okText')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,11 +44,11 @@ export default {
|
|||
<div>
|
||||
{(title || $slots.title) &&
|
||||
<div class={`${prefixCls}-title`}>
|
||||
{getComponentFromProp(this, h, 'title')}
|
||||
{getComponentFromProp(this, 'title')}
|
||||
</div>
|
||||
}
|
||||
<div class={`${prefixCls}-inner-content`}>
|
||||
{getComponentFromProp(this, h, 'content')}
|
||||
{getComponentFromProp(this, 'content')}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import PropTypes from '../../_util/vue-types'
|
||||
import Trigger from '../../trigger'
|
||||
import { placements } from './placements'
|
||||
import hasProp from '../../_util/props-util'
|
||||
import { hasProp, getComponentFromProp } from '../../_util/props-util'
|
||||
function noop () {}
|
||||
export default {
|
||||
props: {
|
||||
|
@ -31,15 +31,13 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
getPopupElement (h) {
|
||||
const { arrowContent, overlay, prefixCls, tipId } = this.$props
|
||||
const { prefixCls, tipId } = this.$props
|
||||
return ([
|
||||
<div class={`${prefixCls}-arrow`} key='arrow'>
|
||||
{this.$slots.arrowContent}
|
||||
{typeof arrowContent === 'function' ? arrowContent(h) : arrowContent}
|
||||
{getComponentFromProp(this, 'arrowContent')}
|
||||
</div>,
|
||||
<div class={`${prefixCls}-inner`} key='content' id={tipId}>
|
||||
{typeof overlay === 'function' ? overlay(h) : overlay}
|
||||
{this.$slots.overlay}
|
||||
{getComponentFromProp(this, 'overlay')}
|
||||
</div>,
|
||||
])
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ import { cloneElement, isValidElement, getClass, getStyle } from '../_util/vnode
|
|||
import RcTooltip from './src/tooltip'
|
||||
import getPlacements from './placements'
|
||||
import PropTypes from '../_util/vue-types'
|
||||
import hasProp from '../_util/props-util'
|
||||
import { hasProp, getComponentFromProp } from '../_util/props-util'
|
||||
import abstractTooltipProps from './abstractTooltipProps'
|
||||
|
||||
const splitObject = (obj, keys) => {
|
||||
|
@ -147,7 +147,7 @@ export default {
|
|||
|
||||
render (h) {
|
||||
const { $props, $data, $slots } = this
|
||||
const { title, prefixCls, openClassName, getPopupContainer, getTooltipContainer } = $props
|
||||
const { prefixCls, openClassName, getPopupContainer, getTooltipContainer } = $props
|
||||
const children = ($slots.default || []).filter(c => c.tag || c.text.trim() !== '')[0]
|
||||
let sVisible = $data.sVisible
|
||||
// Hide tooltip when there is no title
|
||||
|
@ -177,8 +177,7 @@ export default {
|
|||
return (
|
||||
<RcTooltip {...tooltipProps}>
|
||||
<template slot='overlay'>
|
||||
{typeof title === 'function' ? title(h) : title}
|
||||
{$slots.title}
|
||||
{getComponentFromProp(this, 'title')}
|
||||
</template>
|
||||
{sVisible ? cloneElement(child, { class: childCls }) : child}
|
||||
</RcTooltip>
|
||||
|
|
|
@ -231,7 +231,10 @@ export default {
|
|||
}
|
||||
this.preClickTime = 0
|
||||
this.preTouchTime = 0
|
||||
event.preventDefault()
|
||||
event.preventDefault && event.preventDefault()
|
||||
if (event.domEvent) {
|
||||
event.domEvent.preventDefault()
|
||||
}
|
||||
const nextVisible = !this.$data.sPopupVisible
|
||||
if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) {
|
||||
this.setPopupVisible(!this.$data.sPopupVisible)
|
||||
|
@ -507,7 +510,7 @@ export default {
|
|||
this._component = null
|
||||
}
|
||||
newChildProps.addChildren = this._component
|
||||
const trigger = cloneElement(child, newChildProps)
|
||||
const trigger = cloneElement(child, newChildProps, true)
|
||||
return trigger
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue