簡體   English   中英

"沒有國家選擇器的 react-phone-number-input"

[英]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/>

創建自定義類型聲明。步驟:

  1. 創建名為“react-phone-number-input”的文件夾<\/li>
  2. 創建子文件夾輸入<\/li>
  3. 在其中創建 index.d.ts<\/li>
  4. 復制並粘貼以下代碼<\/li><\/ol>

    在這里,我只展示了根據我的要求足夠的最小類型,但它足以構建:

我相信這是他們的指示中的錯誤。 從他們的演示來看,應該是

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM