React EasyUI 開關按鈕

2020-06-24 12:11 更新

開關按鈕( 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>
以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號