vant/docs/markdown/en-US/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` component is an encapsulation of `Switch` and `Cell`.
### Install
``` javascript
import { SwitchCell } from 'vant';
Vue.component(SwitchCell.name, SwitchCell);
```
### Usage
#### Basic Usage
```html
<van-cell-group>
<van-switch-cell v-model="checked" title="Title" />
</van-cell-group>
```
```javascript
export default {
data() {
return {
checked: true
}
}
}
```
#### Disabled
use `disabled` property to disable the component
```html
<van-cell-group>
<van-switch-cell v-model="checked" disabled title="Title" />
</van-cell-group>
```
#### Loading
use `loading` property to keep component in loading state
```html
<van-cell-group>
<van-switch-cell v-model="checked" loading title="Title" />
</van-cell-group>
```
### API
| Attribute | Description | Type | Default | Accepted Values |
|-----------|-----------|-----------|-------------|-------------|
| v-model | on-off state of the switch | `Boolean` | - | - |
| title | the leftside title | `String` | `''` | - |
| loading | whether the component is in loading state | `Boolean` | `false` | - |
| disabled | whether to disable the component | `Boolean` | `false` | - |
### Event
| Event | Description | Attribute |
|-----------|-----------|-----------|
| change | triggered when the on-off state is changed | checked: switch is on or not |