You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/popover/index.jsx

61 lines
1.4 KiB

7 years ago
import Tooltip from '../tooltip'
import abstractTooltipProps from '../tooltip/abstractTooltipProps'
import PropTypes from '../_util/vue-types'
7 years ago
import { getOptionProps, getComponentFromProp } from '../_util/props-util'
7 years ago
7 years ago
const props = abstractTooltipProps()
7 years ago
export default {
name: 'APopover',
7 years ago
props: {
7 years ago
...props,
7 years ago
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) {
7 years ago
const { title, prefixCls, $slots } = this
7 years ago
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'>
7 years ago
<div>
{(title || $slots.title) &&
<div class={`${prefixCls}-title`}>
7 years ago
{getComponentFromProp(this, 'title')}
7 years ago
</div>
}
<div class={`${prefixCls}-inner-content`}>
7 years ago
{getComponentFromProp(this, 'content')}
7 years ago
</div>
</div>
7 years ago
</template>
{this.$slots.default}
</Tooltip>
)
},
}