2018-01-12 08:10:41 +00:00
|
|
|
<script>
|
|
|
|
import Tooltip from '../tooltip'
|
|
|
|
import abstractTooltipProps from '../tooltip/abstractTooltipProps'
|
|
|
|
import PropTypes from '../_util/vue-types'
|
2018-01-12 11:04:42 +00:00
|
|
|
import { getOptionProps, getComponentFromProp } from '../_util/props-util'
|
2018-01-12 08:10:41 +00:00
|
|
|
|
2018-01-15 10:54:26 +00:00
|
|
|
const props = abstractTooltipProps()
|
2018-01-12 08:10:41 +00:00
|
|
|
export default {
|
|
|
|
name: 'popover',
|
|
|
|
props: {
|
2018-01-15 10:54:26 +00:00
|
|
|
...props,
|
2018-01-12 08:10:41 +00: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 09:33:34 +00:00
|
|
|
const { title, prefixCls, $slots } = this
|
2018-01-12 08:10:41 +00: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 11:04:42 +00:00
|
|
|
<div>
|
|
|
|
{(title || $slots.title) &&
|
|
|
|
<div class={`${prefixCls}-title`}>
|
2018-01-18 02:43:39 +00:00
|
|
|
{getComponentFromProp(this, 'title')}
|
2018-01-12 11:04:42 +00:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
<div class={`${prefixCls}-inner-content`}>
|
2018-01-18 02:43:39 +00:00
|
|
|
{getComponentFromProp(this, 'content')}
|
2018-01-12 11:04:42 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-01-12 08:10:41 +00:00
|
|
|
</template>
|
|
|
|
{this.$slots.default}
|
|
|
|
</Tooltip>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|