Closed ThiefTMBadBad closed 1 month ago
可以结合umi的国际化插件一起使用实现国际化,比如:
import React from 'react';
import FormRender, { useForm } from 'form-render';
import { useIntl } from '@umijs/max';
export default () => {
const form = useForm();
const intl =useIntl();
const schema={
type: 'object',
properties: {
input: {
title: intl.formatMessage({
id: 'test',
}),,
type: 'string',
widget: 'input'
},
select: {
title: '下拉框',
type: 'string',
widget: 'select',
props: {
options: [
{ label: '早', value: 'a' },
{ label: '中', value: 'b' },
{ label: '晚', value: 'c' }
]
}
}
}
};
const onFinish = (formData) => {
console.log('formData:', formData);
};
return (
<FormRender
form={form}
schema={schema}
onFinish={onFinish}
maxWidth={60}
footer={true}
/>
);
}
zh-CN.ts
export default {
test: "输入框",
};
如题