소스 검색

:construction: pro-form reset

Jeremy Zheng 3 년 전
부모
커밋
dd801e19d7
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      dashboard/src/components/nut/Form.tsx

+ 6 - 0
dashboard/src/components/nut/Form.tsx

@@ -20,6 +20,9 @@ const Widget = () => {
 
 
     formRef.current?.setFieldsValue({ sv: it });
     formRef.current?.setFieldsValue({ sv: it });
   };
   };
+  const onReset = () => {
+    formRef.current?.resetFields();
+  };
   return (
   return (
     <ProForm<IFormData>
     <ProForm<IFormData>
       name="demo"
       name="demo"
@@ -32,6 +35,9 @@ const Widget = () => {
               <Button htmlType="button" onClick={onWhat} key="what">
               <Button htmlType="button" onClick={onWhat} key="what">
                 What?
                 What?
               </Button>
               </Button>
+              <Button htmlType="button" onClick={onReset} key="reset">
+                Reset
+              </Button>
             </Button.Group>,
             </Button.Group>,
           ];
           ];
         },
         },