mirror of
https://github.com/youzan/vant.git
synced 2025-12-24 02:02:09 +08:00
[Improvement] Reorganize document (#1066)
This commit is contained in:
64
packages/switch-cell/en-US.md
Normal file
64
packages/switch-cell/en-US.md
Normal file
@@ -0,0 +1,64 @@
|
||||
## SwitchCell
|
||||
`SwitchCell` component is an encapsulation of `Switch` and `Cell`.
|
||||
|
||||
### Install
|
||||
``` javascript
|
||||
import { SwitchCell } from 'vant';
|
||||
|
||||
Vue.use(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 |
|
||||
|-----------|-----------|-----------|-------------|
|
||||
| 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 | Arguments |
|
||||
|-----------|-----------|-----------|
|
||||
| change | triggered when the on-off state is changed | checked: switch is on or not |
|
||||
64
packages/switch-cell/zh-CN.md
Normal file
64
packages/switch-cell/zh-CN.md
Normal file
@@ -0,0 +1,64 @@
|
||||
## SwitchCell 开关单元格
|
||||
|
||||
`SwitchCell`组件是对`Switch`和`Cell`组件的封装
|
||||
|
||||
### 使用指南
|
||||
``` javascript
|
||||
import { SwitchCell } from 'vant';
|
||||
|
||||
Vue.use(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: 是否选中开关 |
|
||||
Reference in New Issue
Block a user