You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# 用法示例
|
|
|
|
|
|
|
|
- order: 0
|
|
|
|
|
|
|
|
switch 用法
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var Switch = antd.Switch;
|
|
|
|
var container = document.getElementById('components-switch-demo-basic');
|
|
|
|
|
|
|
|
function onChange(checked){
|
|
|
|
console.log('switch to ' + checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
React.render(<div>
|
|
|
|
<p>
|
|
|
|
simple:
|
|
|
|
<Switch defaultChecked={false} onChange={onChange}/><br/>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
disabled:
|
|
|
|
<Switch disabled/><br/>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
children:
|
|
|
|
<Switch checkedChildren="开" unCheckedChildren="关"/><br/>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
icon children:
|
|
|
|
<Switch checkedChildren={<i className="anticon anticon-check"></i>} unCheckedChildren={<i className="anticon anticon-cross"></i>}/>
|
|
|
|
</p>
|
|
|
|
</div>, container);
|
|
|
|
````
|