[new feature] #734 swipe组件支持垂直滚动 (#938)

This commit is contained in:
nrz
2018-04-27 22:57:44 +08:00
committed by neverland
parent fa8f88c7be
commit 21372bea96
7 changed files with 109 additions and 23 deletions
+12
View File
@@ -25,6 +25,15 @@
<van-swipe-item>4</van-swipe-item>
</van-swipe>
</demo-block>
<demo-block :title="$t('title4')">
<van-swipe :autoplay="3000" vertical>
<van-swipe-item>1</van-swipe-item>
<van-swipe-item>2</van-swipe-item>
<van-swipe-item>3</van-swipe-item>
<van-swipe-item>4</van-swipe-item>
</van-swipe>
</demo-block>
</demo-section>
</template>
@@ -34,11 +43,13 @@ export default {
'zh-CN': {
title2: '图片懒加载',
title3: '监听 change 事件',
title4: '纵向滚动',
message: '当前 Swipe 索引:'
},
'en-US': {
title2: 'Image Lazyload',
title3: 'Change Event',
title4: 'Vertical Scrolling',
message: 'Current Swipe index:'
}
},
@@ -68,6 +79,7 @@ export default {
.van-swipe {
cursor: pointer;
height: 140px;
&-item {
color: #fff;
+12
View File
@@ -66,6 +66,17 @@ export default {
}
```
#### Vertical Scrolling
```html
<van-swipe :autoplay="3000" vertical>
<van-swipe-item>1</van-swipe-item>
<van-swipe-item>2</van-swipe-item>
<van-swipe-item>3</van-swipe-item>
<van-swipe-item>4</van-swipe-item>
</van-swipe>
```
### API
| Attribute | Description | Type | Default | Accepted Values |
@@ -75,6 +86,7 @@ export default {
| loop | Whether to enable loop | `Boolean` | `true` | - |
| show-indicators | Whether to show indocators | `Boolean` | `true` | - |
| initial-swipe | Index of initial swipe, start from 0 | `Number` | `0` | - |
| vertical | Vertical Scrolling | `Boolean` | `false` | - |
### Event
+12
View File
@@ -66,6 +66,17 @@ export default {
}
```
#### 纵向滚动
```html
<van-swipe :autoplay="3000" vertical>
<van-swipe-item>1</van-swipe-item>
<van-swipe-item>2</van-swipe-item>
<van-swipe-item>3</van-swipe-item>
<van-swipe-item>4</van-swipe-item>
</van-swipe>
```
### API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
@@ -75,6 +86,7 @@ export default {
| loop | 是否开启循环播放 | `Boolean` | `true` | - |
| show-indicators | 是否显示指示器 | `Boolean` | `true` | - |
| initial-swipe | 初始位置,从 0 开始算 | `Number` | `0` | - |
| vertical | 纵向滚动 | `Boolean` | `false` | - |
### 事件
+1 -1
View File
@@ -138,7 +138,7 @@ module.exports = {
},
{
path: '/slider',
title: 'Slider - 滑块'
title: 'Slider - 滑块'
},
{
path: '/stepper',