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>
|
||||
<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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user