<view class="swiper" style="{{utils.containerSize(screenWidth,screenHeight)}}">
<view
bindtouchmove="touchmoveList"
bindtouchend="touchendList"
class="swiper-list {{canAnimate?'swiper-animation':''}}"
style="width: {{imgList.length * 750}}rpx;height: {{screenHeight}}px;left: {{currentPageX}}px;"
>
<view
tt:for="{{imgList}}"
class="swiper-item"
style="{{utils.containerSize(screenWidth,screenHeight)}}"
>
<custom-dragImg
tt:if="{{utils.includesKeyword(catchList,current+'-'+index)}}"
class="custom-dragImg"
bindstart="touchStartList"
isClean="{{isClean}}"
imgInfo="{{item}}"
imgIndex="{{index}}"
current="{{currentSwiperIndex}}"
currentRelicIndex="{{current}}"
isDetail="{{isDetail}}"
firstImgHeight="{{firstImgHeight}}"
relics="{{relicsList[current]}}"
/>
</view>
</view>
</view>
.swiper {
position: relative;
transform: translate3d(0px, 0px, 0px);
}
.swiper-list {
position: absolute;
top: 0;
display: flex;
transform: translate3d(0px, 0px, 0px);
transition-property: height;
transition-timing-function: linear;
transition-duration: 0.2s;
}
.swiper-item {
box-sizing: border-box;
position: relative;
overflow: hidden;
transition: height linear 0.2s;
box-sizing: content-box;
margin-left: -1px;
padding-left: 1px;
transform: translate3d(0px, 0px, 0px);
}
<view
class="dragImg {{showMovableTransitionClass?'dragImgTransition':''}}"
bindtouchstart="startTouchContainer"
bindtap="tapPaint"
style="{{utils.containerSize(movableAreaWidth,movableContainerHeight)}};{{u tils.containerBackground(imgInfo.classificationType)}}"
>
<view
class="movableContainer {{showMovableTransitionClass?'movableContainerTransition':''}}"
style="padding-top: {{statusBarHeight}}px;{{utils.containerBackground(imgInfo.classificationType)}}{{utils.containerSize(movableAreaWidth,movableContainerHeight)}}"
>
<movable-area
tt:if="{{showMovable}}"
bindtouchstart="toStartSwiper"
data-type="movableArea"
style="{{utils.containerSize(movableAreaWidth,movableAreaHeight)}}"
class="movableArea"
scale-area="{{true}}"
>
<movable-view
bindtouchend="handleTouchEndMovable"
bindtouchmove="moveMovable"
scale-value="{{scale}}"
scale-min="{{0.5}}"
scale-max="{{scaleMax}}"
bindchange="{{imgShapeMode === 'high'?'verticalPositionChange':'horizontalPositionChange'}}"
bindscale="{{imgTypeMode === 'vertical'?'verticalScaleChange':imgTypeMode === 'horizontal'?'horizontalScaleChange':'innerScaleChange'}}"
x="{{x}}"
y="{{y}}"
inertia="{{false}}"
scale="{{!imgInfo.is3D&&canScale}}"
out-of-bounds="{{false}}"
style="{{imgInfo.is3D ? utils.containerSize(movableAreaWidth,movableAreaHeight): utils.containerSize(movableViewWidth,movableViewHeight)}}"
class="movableView {{showMovableTransitionClass?'movableTransition':''}}"
direction="{{utils.calcDirection(imgInfo,recordScale,direction,imgTypeMode)}}"
animation="{{false}}"
>
<!-- 沉浸态 -->
<image
hidden="{{isDetail}}"
bindload="imgLoaded"
binderror="imgLoadError"
bindtouchstart="typeTouch"
data-touchtype="origin"
src="{{imgInfo.url}}"
/>
<!-- 详情态 -->
<!-- 细节图也加载高清 -->
<image
hidden="{{!isDetail}}"
bindtouchstart="typeTouch"
data-touchtype="origin"
src="{{imgIndex === 0 ? imgInfo.medium_size_url : imgInfo.url}}"
/>
</movable-view>
</movable-area>
</view>
</view>
.dragImg {
position: relative;
box-sizing: border-box;
transform: translate3d(0px, 0px, 0px);
}
.movableContainerTransition {
transition: height linear 0.2s;
}
.movableArea {
position: relative;
transform: translate3d(0, 0, 0) !important;
}
.movableTransition {
transition: all linear 0.2s;
}
.movableView > image {
position: relative;
/* 解决IOS放大后模糊的问题 */
width: 400%;
height: 400%;
transform-origin: left top;
transform: translate3d(0, 0, 0) scale(0.25, 0.25);
/* 解决IOS放大后模糊的问题end */
}
复现效果:可抖音搜索“河南博物院”(IOS端),点开小程序,点进文物详情页(非有3D资源的文物),在详情态或沉浸态从左到右再从右到左来回切换图片
在百度找过相关方法并已尝试,但效果不理想:
干嘛不简单点做个弹出层里面放movable-view加载图片呢?