Skip to content

Commit 7bfe30d

Browse files
authored
docs(Modal): confirm default oktext synch (#6745) (#6748)
* docs(Modal): confim default oktext synch * fix: okText logic
1 parent 53dc5da commit 7bfe30d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

components/modal/ConfirmDialog.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export default defineComponent<ConfirmDialogProps>({
8888
onCancel,
8989
onOk,
9090
close,
91+
okText,
9192
closable = false,
9293
zIndex,
9394
afterClose,
@@ -141,9 +142,6 @@ export default defineComponent<ConfirmDialogProps>({
141142
const prefixCls = props.prefixCls || 'ant-modal';
142143
const contentPrefixCls = `${prefixCls}-confirm`;
143144
const style = attrs.style || {};
144-
const okText =
145-
renderSomeContent(props.okText) ||
146-
(okCancel ? locale.value.okText : locale.value.justOkText);
147145
const mergedOkCancel = okCancel ?? type === 'confirm';
148146
const autoFocusButton =
149147
props.autoFocusButton === null ? false : props.autoFocusButton || 'ok';
@@ -157,6 +155,8 @@ export default defineComponent<ConfirmDialogProps>({
157155
attrs.class,
158156
);
159157

158+
const mergedLocal = locale.value;
159+
160160
const cancelButton = mergedOkCancel && (
161161
<ActionButton
162162
actionFn={onCancel}
@@ -165,7 +165,7 @@ export default defineComponent<ConfirmDialogProps>({
165165
buttonProps={cancelButtonProps}
166166
prefixCls={`${rootPrefixCls}-btn`}
167167
>
168-
{renderSomeContent(props.cancelText) || locale.value.cancelText}
168+
{renderSomeContent(props.cancelText) || mergedLocal.cancelText}
169169
</ActionButton>
170170
);
171171
return (
@@ -219,7 +219,7 @@ export default defineComponent<ConfirmDialogProps>({
219219
buttonProps={okButtonProps}
220220
prefixCls={`${rootPrefixCls}-btn`}
221221
>
222-
{okText}
222+
{okText || (mergedOkCancel ? mergedLocal.okText : mergedLocal.justOkText)}
223223
</ActionButton>
224224
</div>
225225
)}

0 commit comments

Comments
 (0)