W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
單選框( RadioButton )允許用戶選擇一組選項中的某一項。
名稱 | 數(shù)據(jù)類型 | 作用描述 | 默認值 |
---|---|---|---|
value | string, number | 綁定到組件的值。 | null |
groupValue | string, number | 綁定到組件的一組值。 | null |
disabled | boolean | 是否禁用該字段。 | false |
name | string | 字段組的名稱。 | null |
inputId | string | 單選按鈕的id屬性值。 | null |
名稱 | 參數(shù) | 作用描述 |
---|---|---|
onChange | checked | 檢查或未選中組件時觸發(fā)。 |
注:
- 繼承: FieldBase 。
{
this.state.fruits.map(fruit => {
return (
<div key={fruit}>
<RadioButton
inputId={fruit}
value={fruit}
groupValue={this.state.fruit}
onChange={(checked) => this.handleChange(fruit, checked)}
/>
<Label htmlFor={fruit} style={{ margin: '0 5px' }}>{fruit}</Label>
</div>
)
})
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: