![](/img/trans.png)
[英]React-Phone-Number-Input + React-Hook-Form: How to get current country code in controller validation?
[英]react-phone-number-input without the country selector
我正在嘗試使用流行的
react-phone-number-input<\/a>包,但是,打字稿出現各種錯誤,當使用
with country<\/code> \/地區選項時,一切都找到了,到目前為止我做了什么:
npm install --save react-phone-number-input
npm install --save @types/react-phone-number-input
import PhoneInput from 'react-phone-number-input'
<PhoneInput/>
創建自定義類型聲明。步驟:
在這里,我只展示了根據我的要求足夠的最小類型,但它足以構建:
我相信這是他們的指示中的錯誤。 從他們的演示來看,應該是
import Input from 'react-phone-number-input/input'
<Input
placeholder="Enter phone number"
value={value}
onChange={setValue} />
請注意,它是 Input,而不是 PhoneInput。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.