[英]How to transform value of Form.Item before submit on Ant Design?
I want to transform some values of the Form before its submission (I know I could transform the values onFinish
, but I would like this to be automatically-ish).我想在提交之前转换 Form 的一些值(我知道我可以转换值
onFinish
,但我希望这是自动的)。
I have made an example with the specific case here: https://codesandbox.io/s/silly-leakey-g0uzs?file=/src/App.js我在这里做了一个具体案例的例子: https://codesandbox.io/s/silly-leakey-g0uzs?file=/src/App.js
You could try storing user's input in the component state instead.您可以尝试将用户的输入存储在组件 state 中。 This way you can structure your request body however you want.
这样,您可以根据需要构建请求正文。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.