mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 05:29:37 +08:00
666 B
666 B
用法示例
- order: 0
switch 用法
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);