[new feature] ImagePreview: add className prop (#2433)

This commit is contained in:
neverland 2019-01-03 23:20:24 +08:00 committed by GitHub
parent fad49ea1c7
commit 5c3388c8a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,7 @@
<transition name="van-fade"> <transition name="van-fade">
<div <div
v-if="value" v-if="value"
:class="b()" :class="[b(), className]"
@touchstart="onWrapperTouchStart" @touchstart="onWrapperTouchStart"
@touchend="onWrapperTouchEnd" @touchend="onWrapperTouchEnd"
@touchcancel="onWrapperTouchEnd" @touchcancel="onWrapperTouchEnd"
@ -75,6 +75,7 @@ export default create({
asyncClose: Boolean, asyncClose: Boolean,
startPosition: Number, startPosition: Number,
showIndicators: Boolean, showIndicators: Boolean,
className: [String, Object, Array],
loop: { loop: {
type: Boolean, type: Boolean,
default: true default: true

View File

@ -59,6 +59,7 @@ setTimeout(() => {
| loop | Whether to enable loop | `Boolean` | `true` | | loop | Whether to enable loop | `Boolean` | `true` |
| onClose | Close callback | `Function` | - | | onClose | Close callback | `Function` | - |
| asyncClose | Whether to enable async close | `Boolean` | `false` | | asyncClose | Whether to enable async close | `Boolean` | `false` |
| className | Custom className | `String | Array | Object` | - |
### onClose Parematers ### onClose Parematers

View File

@ -8,6 +8,7 @@ const defaultConfig = {
images: [], images: [],
loop: true, loop: true,
value: true, value: true,
className: '',
showIndex: true, showIndex: true,
asyncClose: false, asyncClose: false,
startPosition: 0, startPosition: 0,

View File

@ -67,6 +67,7 @@ setTimeout(() => {
| loop | 是否开启循环播放 | `Boolean` | `true` | 1.4.4 | | loop | 是否开启循环播放 | `Boolean` | `true` | 1.4.4 |
| onClose | 关闭时的回调函数 | `Function` | - | 1.1.16 | | onClose | 关闭时的回调函数 | `Function` | - | 1.1.16 |
| asyncClose | 是否开启异步关闭 | `Boolean` | `false` | 1.4.8 | | asyncClose | 是否开启异步关闭 | `Boolean` | `false` | 1.4.8 |
| className | 自定义类名 | `String | Array | Object` | - | 1.5.2 |
### onClose 回调参数 ### onClose 回调参数

2
types/dialog.d.ts vendored
View File

@ -5,7 +5,7 @@ export type DialogOptions = {
title?: string; title?: string;
message?: string; message?: string;
overlay?: boolean; overlay?: boolean;
className?: string; className?: any;
lockScroll?: boolean; lockScroll?: boolean;
messageAlign?: string; messageAlign?: string;
confirmButtonText?: string; confirmButtonText?: string;

View File

@ -1,9 +1,12 @@
import { VanPopupMixin } from './mixins/popup'; import { VanPopupMixin } from './mixins/popup';
export type ImagePreviewOptions = string[] | { export type ImagePreviewOptions = string[] | {
loop?: boolean;
images: string[]; images: string[];
className?: any;
startPosition?: number; startPosition?: number;
showIndex?: boolean; showIndex?: boolean;
asyncClose?: boolean;
showIndicators?: boolean; showIndicators?: boolean;
onClose?: () => any; onClose?: () => any;
}; };