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 (#1046)
This commit is contained in:
parent
3c1e3947fd
commit
df2bc56aff
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="b()">
|
<div :class="b()">
|
||||||
<div
|
<div
|
||||||
v-if="count > 1"
|
|
||||||
:style="trackStyle"
|
:style="trackStyle"
|
||||||
:class="b('track')"
|
:class="b('track')"
|
||||||
@touchstart="onTouchStart"
|
@touchstart="onTouchStart"
|
||||||
@ -12,9 +11,6 @@
|
|||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<div v-else :class="b('track')">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
v-if="showIndicators && count > 1"
|
v-if="showIndicators && count > 1"
|
||||||
:class="b('indicators', { vertical })"
|
:class="b('indicators', { vertical })"
|
||||||
@ -185,12 +181,9 @@ export default create({
|
|||||||
const { delta, active, count, swipes, trackSize } = this;
|
const { delta, active, count, swipes, trackSize } = this;
|
||||||
const atFirst = active === 0;
|
const atFirst = active === 0;
|
||||||
const atLast = active === count - 1;
|
const atLast = active === count - 1;
|
||||||
|
const outOfBounds = !this.loop && ((atFirst && (offset > 0 || move < 0)) || (atLast && (offset < 0 || move > 0)));
|
||||||
|
|
||||||
if (
|
if (outOfBounds || count <= 1) {
|
||||||
!this.loop &&
|
|
||||||
((atFirst && (offset > 0 || move < 0)) ||
|
|
||||||
(atLast && (offset < 0 || move > 0)))
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user