如果React-Phone-Input-2中存在预先存在的值,有没有办法渲染图标或空选择器?
<PhoneNumberInputField
countryCodeEditable={ false }
country={ defaultCountry() }
value={ value }
specialLabel={ translate('profile:profile.phone') }
onChange={ (phoneNumber, data) => handlePhoneChange(phoneNumber, data) }
/>
谢谢!
对我来说这有效
autoFocus:true
并且onFocus
活动有效
<PhoneNumberInputField
countryCodeEditable={ false }
country={ defaultCountry() }
inputProps={{
... // otherprops
autoFocus: value ? true : false,
}}
onFocus={() => {
document.querySelector('.phone-number-field')?.classList.add('focused');
}}
specialLabel={ translate('profile:profile.phone') }
onChange={ (phoneNumber, data) => handlePhoneChange(phoneNumber, data) }
/>
问题是,它聚焦并显示光标