1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00

[bugfix] ImagePreview: can't be closed when contain single image ()

This commit is contained in:
neverland 2018-05-12 10:54:32 +08:00 committed by GitHub
parent 3c1e3947fd
commit df2bc56aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,6 @@
<template>
<div :class="b()">
<div
v-if="count > 1"
:style="trackStyle"
:class="b('track')"
@touchstart="onTouchStart"
@ -12,9 +11,6 @@
>
<slot />
</div>
<div v-else :class="b('track')">
<slot />
</div>
<div
v-if="showIndicators && count > 1"
:class="b('indicators', { vertical })"
@ -185,12 +181,9 @@ export default create({
const { delta, active, count, swipes, trackSize } = this;
const atFirst = active === 0;
const atLast = active === count - 1;
const outOfBounds = !this.loop && ((atFirst && (offset > 0 || move < 0)) || (atLast && (offset < 0 || move > 0)));
if (
!this.loop &&
((atFirst && (offset > 0 || move < 0)) ||
(atLast && (offset < 0 || move > 0)))
) {
if (outOfBounds || count <= 1) {
return;
}