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

开放 useConfig 给用户/开发者 #6500

Closed
guoyunhe opened this issue Dec 26, 2023 · 0 comments · Fixed by #6501
Closed

开放 useConfig 给用户/开发者 #6500

guoyunhe opened this issue Dec 26, 2023 · 0 comments · Fixed by #6501
Labels

Comments

@guoyunhe
Copy link
Contributor

Version of antd-mobile

5.33.2

What is this feature about?

有些时候我们想在自己拓展的组件中用 cancel 和 ok 这样的通用文案,这时候我们只能自己写本地化逻辑,判断语言环境,加载对应的字符串。而如果 antd-mobile 能将内部使用的 useConfig 钩子开放给外部开发者使用,则会大大简化这种场景所需要的代码:

function MyButton() {
  const { locale } = useConfig();
  return <Button>{locale.common.cancel}</Button>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant