docs(Modal): confirm default oktext synch (#6745) (#6748)

* docs(Modal): confim default oktext synch

* fix: okText logic
pull/6817/head
selicens 2023-08-06 12:43:09 +08:00 committed by GitHub
parent 53dc5daaaf
commit 7bfe30d280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -88,6 +88,7 @@ export default defineComponent<ConfirmDialogProps>({
onCancel, onCancel,
onOk, onOk,
close, close,
okText,
closable = false, closable = false,
zIndex, zIndex,
afterClose, afterClose,
@ -141,9 +142,6 @@ export default defineComponent<ConfirmDialogProps>({
const prefixCls = props.prefixCls || 'ant-modal'; const prefixCls = props.prefixCls || 'ant-modal';
const contentPrefixCls = `${prefixCls}-confirm`; const contentPrefixCls = `${prefixCls}-confirm`;
const style = attrs.style || {}; const style = attrs.style || {};
const okText =
renderSomeContent(props.okText) ||
(okCancel ? locale.value.okText : locale.value.justOkText);
const mergedOkCancel = okCancel ?? type === 'confirm'; const mergedOkCancel = okCancel ?? type === 'confirm';
const autoFocusButton = const autoFocusButton =
props.autoFocusButton === null ? false : props.autoFocusButton || 'ok'; props.autoFocusButton === null ? false : props.autoFocusButton || 'ok';
@ -157,6 +155,8 @@ export default defineComponent<ConfirmDialogProps>({
attrs.class, attrs.class,
); );
const mergedLocal = locale.value;
const cancelButton = mergedOkCancel && ( const cancelButton = mergedOkCancel && (
<ActionButton <ActionButton
actionFn={onCancel} actionFn={onCancel}
@ -165,7 +165,7 @@ export default defineComponent<ConfirmDialogProps>({
buttonProps={cancelButtonProps} buttonProps={cancelButtonProps}
prefixCls={`${rootPrefixCls}-btn`} prefixCls={`${rootPrefixCls}-btn`}
> >
{renderSomeContent(props.cancelText) || locale.value.cancelText} {renderSomeContent(props.cancelText) || mergedLocal.cancelText}
</ActionButton> </ActionButton>
); );
return ( return (
@ -219,7 +219,7 @@ export default defineComponent<ConfirmDialogProps>({
buttonProps={okButtonProps} buttonProps={okButtonProps}
prefixCls={`${rootPrefixCls}-btn`} prefixCls={`${rootPrefixCls}-btn`}
> >
{okText} {okText || (mergedOkCancel ? mergedLocal.okText : mergedLocal.justOkText)}
</ActionButton> </ActionButton>
</div> </div>
)} )}