[new feature] ImagePreview: support component call (#3154)

This commit is contained in:
neverland
2019-04-15 19:59:05 +08:00
committed by GitHub
parent ad6be337cc
commit e8762b2a50
3 changed files with 125 additions and 4 deletions
+47 -1
View File
@@ -4,6 +4,8 @@
```js
import { ImagePreview } from 'vant';
Vue.use(ImagePreview);
```
### Usage
@@ -48,7 +50,30 @@ setTimeout(() => {
}, 1000);
```
### Arguments
#### Component Call
```html
<van-image-preview
v-model="show"
:images="images"
/>
```
```js
export default {
data() {
return {
show: false,
images: [
'https://img.yzcdn.cn/1.jpg',
'https://img.yzcdn.cn/2.jpg'
]
};
}
}
```
### Options
| Attribute | Description | Type | Default |
|------|------|------|------|
@@ -64,6 +89,27 @@ setTimeout(() => {
| maxZoom | Max zoom | `Number` | `3` |
| minZoom | Min zoom | `Number` | `1/3` |
### Props
| Attribute | Description | Type | Default |
|------|------|------|------|
| images | Images URL list | `Array` | `[]` |
| start-position | Start position | `Number` | `0` |
| show-index | Whether to show index | `Boolean` | `true` |
| show-indicators | Whether to show indicators | `Boolean` | `false` |
| loop | Whether to enable loop | `Boolean` | `true` |
| async-close | Whether to enable async close | `Boolean` | `false` |
| class-name | Custom className | `String | Array | Object` | - |
| lazy-load | Whether to enable thumb lazy loadshould register [Lazyload](#/en-US/lazyload) component | `Boolean` | `false` |
| max-zoom | Max zoom | `Number` | `3` |
| min-zoom | Min zoom | `Number` | `1/3` |
### Event
| Event | Description | Parameters |
|------|------|------|
| close | Triggered when close | { index, url } |
### onClose Parematers
| Attribute | Description | Type |