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