[improvement] Swipe: add indicator slot

This commit is contained in:
nrz
2018-10-12 18:00:09 +08:00
committed by neverland
parent 93b567fd70
commit 7e8cb981bc
5 changed files with 118 additions and 9 deletions
+32
View File
@@ -88,6 +88,38 @@ export default {
</van-swipe>
```
#### Custom Indicator
```html
<van-swipe @change="onChange">
<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>
<template slot="indicator">
<div class="custom-indicator">
{{ this.current + 1 }}/4
</div>
</template>
</van-swipe>
```
```js
export default {
methods: {
data() {
return {
current: 0
}
},
onChange(index) {
this.current = index;
}
}
}
```
### API
| Attribute | Description | Type | Default |