Ver código fonte

:construction: pro-form reset

Jeremy Zheng 3 anos atrás
pai
commit
dd801e19d7
1 arquivos alterados com 6 adições e 0 exclusões
  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>,
           ];
           ];
         },
         },