docs(ImagePreview): update demo (#7016)

This commit is contained in:
neverland
2020-08-18 21:23:07 +08:00
committed by GitHub
parent 7cc8a68d92
commit 4116bc731a
3 changed files with 82 additions and 61 deletions
+18 -6
View File
@@ -20,7 +20,7 @@ ImagePreview([
]);
```
### Custom config
### Set Start Position
```js
ImagePreview({
@@ -29,9 +29,6 @@ ImagePreview({
'https://img.yzcdn.cn/vant/apple-2.jpg',
],
startPosition: 1,
onClose() {
// do something
},
});
```
@@ -49,6 +46,22 @@ ImagePreview({
});
```
### Close Event
```js
import { Toast } from 'vant';
ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
],
onClose() {
Toast('closed');
},
});
```
### Async Close
```js
@@ -62,7 +75,7 @@ const instance = ImagePreview({
setTimeout(() => {
instance.close();
}, 1000);
}, 2000);
```
### Component Call
@@ -85,7 +98,6 @@ export default {
],
};
},
methods: {
onChange(index) {
this.index = index;