W3Cschool
恭喜您成為首批注冊用戶
獲得88經驗值獎勵
開關按鈕( switchbutton )用于form
表單。
開關按鈕( switchbutton )有兩個狀態(tài):“開”與“關”。用戶可以點擊或輕擊來切換,標簽狀態(tài)可定義。
名稱 | 數(shù)據(jù)類型 | 作用描述 | 默認值 |
---|---|---|---|
value | boolean | 綁定到按鈕的值。 | null |
onText | string | 按鈕狀態(tài)為on時的文本值。 | ON |
offText | string | 按鈕關閉狀態(tài)時的文本值。 | OFF |
handleText | string | 中心句柄的文本值。 | null |
disabled | boolean | 是否為禁用按鈕。 | false |
readonly | boolean | 按鈕是否只讀。 | false |
inputId | string | 輸入框的id屬性值。 | null |
注意:
- 繼承: FieldBase 。
<div style={{ marginBottom: 20 }}>
<Label htmlFor="s1" style={{ width: 150 }}>Receive mail:</Label>
<SwitchButton inputId="s1" value={received} onChange={(value) => this.setState({ received: value })}></SwitchButton>
</div>
<div style={{ marginBottom: 20 }}>
<Label htmlFor="s2" style={{ width: 150 }}>Shared network:</Label>
<SwitchButton inputId="s2" value={shared} onChange={(value) => this.setState({ shared: value })}></SwitchButton>
</div>
<div style={{ marginBottom: 20 }}>
<Label htmlFor="s3" style={{ width: 150 }}>Subscribed:</Label>
<SwitchButton inputId="s3" value={subscribed} onChange={(value) => this.setState({ subscribed: value })}></SwitchButton>
</div>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: