perf(ImagePreview): adjust default swipe duration to 300ms (#7973)

This commit is contained in:
neverland 2021-01-23 15:59:25 +08:00 committed by GitHub
parent 3351f8a07a
commit c532be87ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -54,7 +54,7 @@ export default createComponent({
},
swipeDuration: {
type: [Number, String],
default: 500,
default: 300,
},
startPosition: {
type: [Number, String],

View File

@ -117,7 +117,7 @@ export default {
| showIndex | Whether to show index | _boolean_ | `true` |
| showIndicators | Whether to show indicators | _boolean_ | `false` |
| loop | Whether to enable loop | _boolean_ | `true` |
| swipeDuration | Animation duration (ms) | _number \| string_ | `500` |
| swipeDuration | Animation duration (ms) | _number \| string_ | `300` |
| onClose | Emitted when ImagePreview is closed | _Function_ | - |
| onChange | Emitted when current image changed | _Function_ | - |
| onScale | Emitted when scaling current image | _Function_ | - |
@ -137,7 +137,7 @@ export default {
| --- | --- | --- | --- |
| images | Images URL list | _string[]_ | `[]` |
| start-position | Start position | _number \| string_ | `0` |
| swipe-duration | Animation duration (ms) | _number \| string_ | `500` |
| swipe-duration | Animation duration (ms) | _number \| string_ | `300` |
| show-index | Whether to show index | _boolean_ | `true` |
| show-indicators | Whether to show indicators | _boolean_ | `false` |
| loop | Whether to enable loop | _boolean_ | `true` |

View File

@ -150,7 +150,7 @@ export default {
| --- | --- | --- | --- |
| images | 需要预览的图片 URL 数组 | _string[]_ | `[]` |
| startPosition | 图片预览起始位置索引 | _number \| string_ | `0` |
| swipeDuration | 动画时长,单位为`ms` | _number \| string_ | `500` |
| swipeDuration | 动画时长,单位为`ms` | _number \| string_ | `300` |
| showIndex | 是否显示页码 | _boolean_ | `true` |
| showIndicators | 是否显示轮播指示器 | _boolean_ | `false` |
| loop | 是否开启循环播放 | _boolean_ | `true` |
@ -175,7 +175,7 @@ export default {
| --- | --- | --- | --- |
| images | 需要预览的图片 URL 数组 | _string[]_ | `[]` |
| start-position | 图片预览起始位置索引 | _number \| string_ | `0` |
| swipe-duration | 动画时长,单位为 ms | _number \| string_ | `500` |
| swipe-duration | 动画时长,单位为 ms | _number \| string_ | `300` |
| show-index | 是否显示页码 | _boolean_ | `true` |
| show-indicators | 是否显示轮播指示器 | _boolean_ | `false` |
| loop | 是否开启循环播放 | _boolean_ | `true` |

View File

@ -19,7 +19,7 @@ const defaultConfig = {
asyncClose: false,
getContainer: 'body',
startPosition: 0,
swipeDuration: 500,
swipeDuration: 300,
showIndicators: false,
closeOnPopstate: true,
closeIconPosition: 'top-right',

View File

@ -42,7 +42,7 @@ exports[`index slot 1`] = `
exports[`render image 1`] = `
<div class="van-image-preview" name="van-fade">
<div class="van-swipe van-image-preview__swipe">
<div class="van-swipe__track" style="transition-duration: 500ms; transform: translateX(0px);">
<div class="van-swipe__track" style="transition-duration: 300ms; transform: translateX(0px);">
<div class="van-swipe-item van-image-preview__swipe-item"></div>
<div class="van-swipe-item van-image-preview__swipe-item"></div>
<div class="van-swipe-item van-image-preview__swipe-item"></div>