mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-03 12:37:42 +08:00
feat: popconfirm
This commit is contained in:
parent
fa41d5b205
commit
81e80bfaed
@ -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') || (
|
||||
<Icon type="exclamation-circle" theme="filled" />
|
||||
);
|
||||
@ -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 = {
|
||||
<LocaleReceiver
|
||||
componentName="Popconfirm"
|
||||
defaultLocale={defaultLocale.Popconfirm}
|
||||
scopedSlots={{ default: this.renderOverlay }}
|
||||
scopedSlots={{ default: (popconfirmLocale) => this.renderOverlay(prefixCls, popconfirmLocale) }}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user