Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zhCN模式下,useApp 导出的 modal.confirm 默认的okText属性为"知道了",而库导出的 Modal.confirm 默认的okText 属性值为"确定" #39861

Closed
Huaxink opened this issue Dec 28, 2022 · 5 comments · Fixed by #39884

Comments

@Huaxink
Copy link

Huaxink commented Dec 28, 2022

Reproduction link

Edit on CodeSandbox

Steps to reproduce

import { App, Modal } from "antd";

const { modal } = App.useApp();
modal.confirm({ title: "确认模态框" });
Modal.confirm({ title: "确认模态框" });

确认按钮的问题不一样

What is expected?

确认按钮的文字均为 "确定"

What is actually happening?

useApp 导出的 modal.confirm 确认按钮文字为 "知道了"

库直接导出的 Modal.confirm 确认按钮文字为 "确定"

Environment Info
antd 5.1.1
React 18.2.0
System window10
Browser chrome

ConfigProvider 的 locale={zhCN}

@BoyYangzai
Copy link
Contributor

看了下源码,源代码中okText默认了两种
okText || (mergedOkCancel ? mergedLocale?.okText : mergedLocale?.justOkText
okText确定justOkText知道了
应该是有意这样设计的

@Huaxink
Copy link
Author

Huaxink commented Dec 29, 2022

好的,谢谢,但是这样设计的话,可能容易造成误解,因为同一个组件,都用静态方法调用,参数都一样,但是主按钮的文案却不同

@sushi-su
Copy link

当然是个 BUG ,知道了应该是在没有取消按钮的情况下才会出现

@BoyYangzai
Copy link
Contributor

当然是个 BUG ,知道了应该是在没有取消按钮的情况下才会出现

这样的话确实说得通了

@BoyYangzai
Copy link
Contributor

@Huaxink @sushi-su
我同步了一下modal组件中的逻辑,你们可以看一下
#39884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants