Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

renderFormItem能否支持I18n? #732

Open
gaohongwei opened this issue Feb 21, 2021 · 0 comments
Open

renderFormItem能否支持I18n? #732

gaohongwei opened this issue Feb 21, 2021 · 0 comments

Comments

@gaohongwei
Copy link

gaohongwei commented Feb 21, 2021

🧐 问题描述 [详细地描述问题,让大家都能理解]

renderFormItem 内部的text 需要根据语言而变化

💻 示例代码 [如果有必要,展示代码,线上示例,或仓库]

现有代码是这样
renderFormItem: (item, { defaultRender, ...rest }, form) => {
const status = form.getFieldValue('status');
if (${status} === '0') {
return false;
}
if (${status} === '3') {
return <Input {...rest} placeholder="请输入异常原因!" />;
}
return defaultRender(item);
},

有没有办法把中文部分换为I18n 函数调用?
renderFormItem: (item, { defaultRender, ...rest }, form) => {
const status = form.getFieldValue("status");
if (${status} === "0") {
return false;
}
if (${status} === "3") {
return <Input {...rest} placeholder={i18n("placeholder")} />;
}
return defaultRender(item);
},

i18n可以是I18n 函数
试了一下, 好像不行。

@gaohongwei gaohongwei changed the title valueEnum的text能否支持I18n? renderFormItem能否支持I18n? Feb 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant