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

* docs(Modal): confim default oktext synch

* fix: okText logic
This commit is contained in:
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

View File

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