diff --git a/components/popconfirm/index.jsx b/components/popconfirm/index.jsx index a31f11abe..d11e026f7 100644 --- a/components/popconfirm/index.jsx +++ b/components/popconfirm/index.jsx @@ -9,6 +9,7 @@ import Icon from '../icon'; import Button from '../button'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import defaultLocale from '../locale-provider/default'; +import { ConfigConsumerProps } from '../config-provider'; const tooltipProps = abstractTooltipProps(); const btnProps = buttonTypes(); @@ -16,7 +17,7 @@ const Popconfirm = { name: 'APopconfirm', props: { ...tooltipProps, - prefixCls: PropTypes.string.def('ant-popover'), + prefixCls: PropTypes.string, transitionName: PropTypes.string.def('zoom-big'), content: PropTypes.any, title: PropTypes.any, @@ -38,6 +39,9 @@ const Popconfirm = { this.sVisible = val; }, }, + inject: { + configProvider: { default: () => ({}) }, + }, data() { const props = getOptionProps(this); const state = { sVisible: false }; @@ -72,8 +76,8 @@ const Popconfirm = { getPopupDomNode() { return this.$refs.tooltip.getPopupDomNode(); }, - renderOverlay(popconfirmLocale) { - const { prefixCls, okType, okButtonProps, cancelButtonProps } = this; + renderOverlay(prefixCls, popconfirmLocale) { + const { okType, okButtonProps, cancelButtonProps } = this; const icon = getComponentFromProp(this, 'icon') || ( ); @@ -120,10 +124,15 @@ const Popconfirm = { }, render() { const props = getOptionProps(this); + const { prefixCls: customizePrefixCls } = props; + const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; + const prefixCls = getPrefixCls('popover', customizePrefixCls); + const otherProps = omit(props, ['title', 'content', 'cancelText', 'okText']); const tooltipProps = { props: { ...otherProps, + prefixCls, visible: this.sVisible, }, ref: 'tooltip', @@ -135,7 +144,7 @@ const Popconfirm = { this.renderOverlay(prefixCls, popconfirmLocale) }} /> ); return (