From e53a0e12bd1cad43c16ef80df08633772f15a533 Mon Sep 17 00:00:00 2001 From: luoanbing Date: Sun, 31 Mar 2024 21:53:23 +0800 Subject: [PATCH] =?UTF-8?q?MUI=20=E9=80=82=E9=85=8D=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/src/Antd.tsx | 34 ++++++++++++++++++++++++++++---- test/src/App.tsx | 48 +++++++++++++++++++++++---------------------- test/src/NextUI.tsx | 40 +++++++++++++++++++++++-------------- 3 files changed, 80 insertions(+), 42 deletions(-) diff --git a/test/src/Antd.tsx b/test/src/Antd.tsx index 538a212..e05bc37 100644 --- a/test/src/Antd.tsx +++ b/test/src/Antd.tsx @@ -1,4 +1,15 @@ -import { Button, Checkbox, Input, InputNumber, Radio, Select, Switch, TreeSelect } from 'antd' +import { + Button, + Checkbox, + DatePicker, + Input, + InputNumber, + Radio, + Select, + Switch, + TimePicker, + TreeSelect +} from 'antd' import { Verifications, useAttr, useFormData } from 'hook-form-react' import { Antd_5 } from 'hook-form-react/Antd_5' import { animals, treeData } from './data' @@ -11,7 +22,7 @@ export default function Antd() { value11: 1, value6: true, value2: false, - value7: [], + value7: [] as string[], value3: [], value4: {}, value5: '', @@ -20,7 +31,8 @@ export default function Antd() { { value: [Verifications.required()], value5: [Verifications.required()], - value8: [Verifications.required()], + value7: [Verifications.minLenth(2, '请选择时间范围')], + value8: [Verifications.required('请选择时间')], value10: [Verifications.min(10)] } ) @@ -56,7 +68,21 @@ export default function Antd() { {it.label} ))} - + + + + + + + + + + + + diff --git a/test/src/App.tsx b/test/src/App.tsx index 391180d..5a0be57 100644 --- a/test/src/App.tsx +++ b/test/src/App.tsx @@ -5,28 +5,30 @@ import Antd from './Antd' export default function App() { return ( - - - - - - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + + + + + + + +
) } diff --git a/test/src/NextUI.tsx b/test/src/NextUI.tsx index e7d4959..fbf5df0 100644 --- a/test/src/NextUI.tsx +++ b/test/src/NextUI.tsx @@ -295,21 +295,31 @@ export const NextUI = () => { -
-

Form Value:

-
-          {JSON.stringify(formData.value, null, 1)}
-        
-

SubForm, Value10:

-
{JSON.stringify(value10, null, 1)}
-

Error:

-
-          {JSON.stringify(formData.errors, null, 1)}
-        
-

Value10 Error:

-
-          {JSON.stringify(value10Form.errors, null, 1)}
-        
+
+
+

Form Value:

+
+            {JSON.stringify(formData.value, null, 1)}
+          
+
+
+

SubForm, Value10:

+
+            {JSON.stringify(value10, null, 1)}
+          
+
+
+

Error:

+
+            {JSON.stringify(formData.errors, null, 1)}
+          
+
+
+

Value10 Error:

+
+            {JSON.stringify(value10Form.errors, null, 1)}
+          
+
)