[new feature] ImagePreview: add index slot (#3157)

This commit is contained in:
neverland
2019-04-15 20:59:00 +08:00
committed by GitHub
parent 8d1c02cfbd
commit ce4e0cc3e9
6 changed files with 92 additions and 18 deletions
+17 -1
View File
@@ -56,7 +56,10 @@ setTimeout(() => {
<van-image-preview
v-model="show"
:images="images"
/>
@change="onChange"
>
<template v-slot:index>Page: { index }</template>
</van-image-preview>
```
```js
@@ -64,11 +67,18 @@ export default {
data() {
return {
show: false,
index: 0,
images: [
'https://img.yzcdn.cn/1.jpg',
'https://img.yzcdn.cn/2.jpg'
]
};
},
methods: {
onChange(index) {
this.index = index;
}
}
}
```
@@ -111,6 +121,12 @@ export default {
| close | Triggered when close | { index, url } |
| change | Triggered when current image change | index: index of current image |
### Slot
| name | Description |
|------|------|
| index | Custom index |
### onClose Parematers
| Attribute | Description | Type |