Skip to content

Commit

Permalink
📚 [document] 添加Switch组件文档.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanjingling0510 committed Apr 10, 2017
1 parent 69691e0 commit 1c1772e
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions components/switch/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## 转换开关(Switch)

开关选择器。

### 例子

```jsx
import React, {Component} from 'react';
import Switch from 'react-cqtoolbox/lib/switch';
import Section from 'react-cqtoolbox/lib/section';


class SwitchTest extends Component {
state = {
value: true,
};

handleChange = (value) => {
this.setState({ value: value });
};

render() {
return (
<Section title="转换开关">
<Switch
checked={this.state.value}
label="微信提醒"
onChange={this.handleChange}
/>
</Section>
);
}
}

export default SwitchTest;

```

### 属性(Props)

值 | 值类型 | 默认 | 描述
:---------- | :--------- | :------ | :-----------
`checked` | `Boolean` | `false` | `是否选中`
`disabled` | `Boolean` | `false` | `禁止选中`
`label` | `String` | | `label标签`
`name` | `String` | | `input名字`
`onChange` | `Function` | | `切换后的回调`
`onBlur` | `Function` | | `失去焦点`
`onFocus` | `Function` | | `获得焦点`
`ripple` | `Boolean` | | `是否点击显示波纹动画`
`className` | `string` | | `根元素样式类`
`theme` | `Object` | | `添加自定义主题`

### 主题(Theme)

Name | Description
:--------- | :----------
`field` | `开关(根类)`
`disabled` | `禁止(根类)`
`input` | `input元素`
`off` | `关闭`
`on` | `打开`
`ripple` | `波纹样式`
`text` | `label文字`
`thumb` | `开关按钮`

0 comments on commit 1c1772e

Please sign in to comment.