diff --git a/src/image-preview/ImagePreview.js b/src/image-preview/ImagePreview.js index 7f402caf7..f15c69212 100644 --- a/src/image-preview/ImagePreview.js +++ b/src/image-preview/ImagePreview.js @@ -272,8 +272,8 @@ export default createComponent({ ref="swipe" loop={this.loop} class={bem('swipe')} - duration={this.swipeDuration} indicatorColor="white" + duration={this.swipeDuration} initialSwipe={this.startPosition} showIndicators={this.showIndicators} onChange={this.setActive} diff --git a/src/image-preview/README.zh-CN.md b/src/image-preview/README.zh-CN.md index 7c4bd6ca4..86ebd2bef 100644 --- a/src/image-preview/README.zh-CN.md +++ b/src/image-preview/README.zh-CN.md @@ -107,7 +107,7 @@ export default { | showIndex | 是否显示页码 | *boolean* | `true` | - | | showIndicators | 是否显示轮播指示器 | *boolean* | `false` | - | | loop | 是否开启循环播放 | *boolean* | `true` | - | -| swipeDuration | 动画时长,单位为 ms | *number* | `500` | - | +| swipeDuration | 动画时长,单位为`ms` | *number* | `500` | - | | onClose | 关闭时的回调函数 | *Function* | - | - | | onChange | 切换图片时的回调函数,回调参数为当前索引 | *Function* | - | 2.0.3 | | asyncClose | 是否开启异步关闭 | *boolean* | `false` | - | diff --git a/src/image-preview/index.js b/src/image-preview/index.js index e2ba24945..08742fe30 100644 --- a/src/image-preview/index.js +++ b/src/image-preview/index.js @@ -5,9 +5,8 @@ import { isServer } from '../utils'; let instance; const defaultConfig = { - images: [], loop: true, - swipeDuration: 500, + images: [], value: true, minZoom: 1 / 3, maxZoom: 3, @@ -18,6 +17,7 @@ const defaultConfig = { showIndex: true, asyncClose: false, startPosition: 0, + swipeDuration: 500, showIndicators: false, closeOnPopstate: false }; diff --git a/types/image-preview.d.ts b/types/image-preview.d.ts index e6cb9a775..4b1c7736d 100644 --- a/types/image-preview.d.ts +++ b/types/image-preview.d.ts @@ -6,10 +6,11 @@ export type ImagePreviewOptions = string[] | { maxZoom?: number; minZoom?: number; className?: any; - startPosition?: number; lazyLoad?: boolean; showIndex?: boolean; asyncClose?: boolean; + swipeDuration?: number; + startPosition?: number; showIndicators?: boolean; closeOnPopstate?: boolean; onClose?: () => void;