小程序顶部banner图在模拟环境中没有问题,但是发布之后,在真机中就一直抖动,如下图
<scroll-view style=“width:100%;height:100%” scroll-y=“true” bindscroll=“scrollTopFun” scroll-with-animation=“true” scroll-top="{{scrollTop}}">
<view class=“page-section page-section-spacing” bindtap=“goJnh”>
<swiper class=“swiper” indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" circular="{{circular}}" vertical="{{vertical}}" interval="{{interval}}" duration="{{duration}}" previous-margin="{{previousMargin}}px" next-margin="{{nextMargin}}px" bindchange=‘bindchange’ current="{{current}}" style=“height:{{imgheights[current]}}rpx;”>
<block wx:for="{{background}}" wx:key="*this">
<swiper-item>
<image mode=“widthFix” src="{{item}}" bindload=“imageLoad” data-index=’{{index}}’ class=“slide-image” width=“355” height=“200” />
</swiper-item>
</block>
</swiper>
<text class=“banner-text”>国家AAAA级景区———金牛湖旅游度假区</text>
</view>
JS代码:
wx.request({//获取banner列表
url: //
隐藏。。
method: “GET”,
header: {
‘Content-Type’: ‘json’
},
success: function (res) {
that.setData({
background: res.data.list,
imgUrls: res.data.list
})
}
})
Page({
data: {
trafficList: [],
ticketList: [],
background: [],
indicatorDots: true,
vertical: false,
autoplay: true,
circular: false,
interval: 2000,
duration: 500,
previousMargin: 0,
nextMargin: 0,
curPage: 1,
current: 0,
x: 0,
hotelList:[],
hotList:[],
foodList:[],
src: “”,
audioAction: {
method: ‘pause’
},
index: -1,
navTop:0,
navTop2: 10000,
hotTop:0,
footTop:0,
hotelTop:0,
ticketTop:0,
trafficTop:0,
showNavSelet:‘hot’,
imgheights: [],
imgUrls: [],
swiperIndex: 0
},
onLoad: function () {
let hotelList = [], hotList = [], that = this;
wx.showLoading({
title: ‘加载中’,
})