我正在使用来自 react-phone-input-international 的 PhoneInput 和用于表单生成器的 formik,当我尝试在按钮上使用类型提交时它不起作用。 这是我的代码
<form onSubmit={formik.handleSubmit}>
<PhoneInput
name="mobileNumber"
country={'in'}
value={formik.values.mobileNumber}
placeholder=""
countryCodeEditable={false}
onChange={(value, country, e, formattedValue) => {
formik.setValues({
...formik.values,
"mobileNumber": formattedValue && formattedValue.replace(/ /g, '')
})
}
}
/>
<Box className="send-otp">
<Button
otpBtn
type='submit'
name={(t(`btn.send_otp`))}
/>
</Box>
</form>
我正在尝试在按钮上输入提交但不工作。 这是codesandboxhttps://codesandbox.io/s/phoneinput-react-gybgzd