2018-01-12 16:10:41 +08:00
|
|
|
<script>
|
|
|
|
import Tooltip from '../tooltip'
|
|
|
|
import abstractTooltipProps from '../tooltip/abstractTooltipProps'
|
|
|
|
import PropTypes from '../_util/vue-types'
|
2018-01-12 19:04:42 +08:00
|
|
|
import { getOptionProps, getComponentFromProp } from '../_util/props-util'
|
2018-01-12 16:10:41 +08:00
|
|
|
|
2018-01-15 18:54:26 +08:00
|
|
|
const props = abstractTooltipProps()
|
2018-01-12 16:10:41 +08:00
|
|
|
export default {
|
|
|
|
name: 'popover',
|
|
|
|
props: {
|
2018-01-15 18:54:26 +08:00
|
|
|
...props,
|
2018-01-12 16:10:41 +08:00
|
|
|
prefixCls: PropTypes.string.def('ant-popover'),
|
|
|
|
transitionName: PropTypes.string.def('zoom-big'),
|
|
|
|
content: PropTypes.any,
|
|
|
|
title: PropTypes.any,
|
|
|
|
},
|
|
|
|
model: {
|
|
|
|
prop: 'visible',
|
|
|
|
event: 'change',
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getPopupDomNode () {
|
|
|
|
return this.$refs.tooltip.getPopupDomNode()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
render (h) {
|
2018-01-15 17:33:34 +08:00
|
|
|
const { title, prefixCls, $slots } = this
|
2018-01-12 16:10:41 +08:00
|
|
|
const props = getOptionProps(this)
|
|
|
|
delete props.title
|
|
|
|
delete props.content
|
|
|
|
const tooltipProps = {
|
|
|
|
props: {
|
|
|
|
...props,
|
|
|
|
},
|
|
|
|
ref: 'tooltip',
|
|
|
|
on: this.$listeners,
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<Tooltip
|
|
|
|
{...tooltipProps}
|
|
|
|
>
|
|
|
|
<template slot='title'>
|
2018-01-12 19:04:42 +08:00
|
|
|
<div>
|
|
|
|
{(title || $slots.title) &&
|
|
|
|
<div class={`${prefixCls}-title`}>
|
2018-01-18 10:43:39 +08:00
|
|
|
{getComponentFromProp(this, 'title')}
|
2018-01-12 19:04:42 +08:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
<div class={`${prefixCls}-inner-content`}>
|
2018-01-18 10:43:39 +08:00
|
|
|
{getComponentFromProp(this, 'content')}
|
2018-01-12 19:04:42 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-01-12 16:10:41 +08:00
|
|
|
</template>
|
|
|
|
{this.$slots.default}
|
|
|
|
</Tooltip>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|