[improvement] Swipe: add indicator slot
This commit is contained in:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user