feat: update popover

pull/802/head
wangxueliang 6 years ago
parent 81e80bfaed
commit c54a20301a

@ -2,6 +2,7 @@ import Tooltip from '../tooltip';
import abstractTooltipProps from '../tooltip/abstractTooltipProps'; import abstractTooltipProps from '../tooltip/abstractTooltipProps';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponentFromProp } from '../_util/props-util'; import { getOptionProps, getComponentFromProp } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
const props = abstractTooltipProps(); const props = abstractTooltipProps();
const Popover = { const Popover = {
@ -17,6 +18,9 @@ const Popover = {
prop: 'visible', prop: 'visible',
event: 'visibleChange', event: 'visibleChange',
}, },
inject: {
configProvider: { default: () => ({}) },
},
methods: { methods: {
getPopupDomNode() { getPopupDomNode() {
return this.$refs.tooltip.getPopupDomNode(); return this.$refs.tooltip.getPopupDomNode();
@ -24,13 +28,17 @@ const Popover = {
}, },
render() { render() {
const { title, prefixCls, $slots } = this; const { title, prefixCls: customizePrefixCls, $slots } = this;
const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls;
const prefixCls = getPrefixCls('popover', customizePrefixCls);
const props = getOptionProps(this); const props = getOptionProps(this);
delete props.title; delete props.title;
delete props.content; delete props.content;
const tooltipProps = { const tooltipProps = {
props: { props: {
...props, ...props,
prefixCls,
}, },
ref: 'tooltip', ref: 'tooltip',
on: this.$listeners, on: this.$listeners,

Loading…
Cancel
Save