[FormItem] 如何自定义required的内容 #4115
Replies: 1 comment
-
import React from 'react'
import {FormButtonGroup, FormItem, Input, Submit} from '@formily/next'
import {createForm} from '@formily/core'
import {createSchemaField, FormProvider} from '@formily/react'
const SchemaField = createSchemaField({
components: {
Input,
FormItem,
},
})
const form = createForm()
const schema = {
type: 'object',
properties: {
input: {
type: 'string',
title: 'Datasource ID',
'x-decorator': 'FormItem',
'x-component': 'Input',
'x-validator': {
required: true,
message: 'Required value'
}
},
},
}
function App() {
return (
<FormProvider form={form}>
<SchemaField schema={schema}>
</SchemaField>
<FormButtonGroup>
<Submit onSubmit={console.log}>Submit</Submit>
</FormButtonGroup>
</FormProvider>
);
}
export default App; 已解决 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
shiwofeiwo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
如果我想自定义报错信息的话改如何配置formItem, 在api中没有找到对应的属性, feedbackText似乎不符合我的需求
使用的是@formily/next
Beta Was this translation helpful? Give feedback.
All reactions