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

View File

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

View File

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

View File

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

2
types/dialog.d.ts vendored
View File

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

View File

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