vant/docs/markdown/zh-CN/switch-cell.md
neverland d8b6ad7d54
[new feature] add i18n support (#310)
* fix: Tabbar icon line-height

* [new feature] progress add showPivot prop

* [new feature] TabItem support vue-router

* [new feature] update document header style

* [Doc] add toast english ducoment

* [new feature] add i18n support

* feat: Extract demos from markdown

* feat: Base components demos

* [new feature] complete demo extract & translate

* [fix] text cases

* fix: add deepAssign test cases

* fix: changelog detail

* [new feature] AddressEdit support i18n
2017-11-15 20:08:51 -06:00

64 lines
1.3 KiB
Markdown

## SwitchCell 开关单元格
`SwitchCell`组件是对`Switch``Cell`组件的封装
### 使用指南
``` javascript
import { SwitchCell } from 'vant';
Vue.component(SwitchCell.name, SwitchCell);
```
### 代码演示
#### 基础用法
```html
<van-cell-group>
<van-switch-cell v-model="checked" title="标题" />
</van-cell-group>
```
```javascript
export default {
data() {
return {
checked: true
}
}
}
```
#### 禁用状态
通过`disabled`属性可以将组件设置为禁用状态
```html
<van-cell-group>
<van-switch-cell v-model="checked" disabled title="标题" />
</van-cell-group>
```
#### 加载状态
通过`loading`属性可以将组件设置为加载状态
```html
<van-cell-group>
<van-switch-cell v-model="checked" loading title="标题" />
</van-cell-group>
```
### API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|-----------|-----------|-----------|-------------|-------------|
| v-model | 开关状态 | `Boolean` | - | - |
| title | 左侧标题 | `String` | `''` | - |
| loading | 是否为加载状态 | `Boolean` | `false` | - |
| disabled | 是否为禁用状态 | `Boolean` | `false` | - |
### Event
| 事件名 | 说明 | 参数 |
|-----------|-----------|-----------|
| change | 开关状态切换回调 | checked: 是否选中开关 |