我已成功集成react-intl-tel-input-v2用于國際電話號碼輸入。這是代碼
class App extends Component {
constructor() {
super();
this.state = {
name: 'React',
value: { iso2: 'cn', dialCode: '86', phone: '12345678901' },
};
}
onChange = (value) =>
this.setState({ value }, () => console.log(this.state.value));
render() {
return (
<div>
<Hello name={this.state.name} />
<ReactIntlTelInput
value={this.state.value}
onChange={this.onChange}
/>
<h4>{JSON.stringify(this.state.value)}</h4>
</div>
);
}
}
現在我的問題是我想禁用這個組件。我沒有找到任何適當的檔案來禁用它。我也檢查了不同的道具,但沒有成功。你也可以查看代碼stackblitz
uj5u.com熱心網友回復:
您好,您可以嘗試以下禁用ReactIntlTelInput組件
<ReactIntlTelInput
value={this.state.value}
onChange={this.onChange}
allowDropdown={false}
inputProps={{ disabled: true }}
/>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/466351.html
標籤:javascript 反应 禁用
