ant-design/components/switch/demo/basic.md

34 lines
375 B
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 0
2016-07-26 09:17:46 +08:00
title:
zh-CN: 基本
en-US: Basic
2016-03-31 09:40:55 +08:00
---
2015-07-08 19:47:45 +08:00
2016-07-26 09:17:46 +08:00
## zh-CN
2015-07-13 16:51:56 +08:00
最简单的用法。
2015-07-08 19:47:45 +08:00
2016-07-26 09:17:46 +08:00
## en-US
The most basic usage.
2017-02-13 10:55:53 +08:00
````jsx
import { Switch } from 'antd';
2015-07-08 19:47:45 +08:00
function onChange(checked) {
console.log(`switch to ${checked}`);
2015-07-08 19:47:45 +08:00
}
ReactDOM.render(
2017-12-06 20:20:32 +08:00
<Switch defaultChecked onChange={onChange} />,
mountNode
);
2015-07-08 19:47:45 +08:00
````
2016-06-15 14:13:38 +08:00
<style>
.ant-switch {
margin-bottom: 8px;
}
2017-12-15 13:47:46 +08:00
</style>