navigateto之后进去页面,不管从onload onready 还是onshow都有概率出现取不到长宽的问题,手机是小米5s
小程序首页
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
var app = getApp();
var that = this;
//读取屏幕尺寸
var sysInfo = wx.getSystemInfo({
success: function (res) {
var windowWidth = res.windowWidth;
that.setData({ windowWidth });
},
});
wx.navigateTo({
url: ‘/pages/guide-page/guide-page’,
});
},
跳转后的页面
<!–pages/guide-page/guide-page.wxml–>
<view class=“root”>
<swiper class=“swiper” style=‘width:100%;height:{{systemInfo.windowHeight}}px’>
<swiper-item class=“swiper-item” style=“width:100%;height:100%”>
<image src=“http://picture.fiteam.mejimeji.net/guide-page/1.png” style=“width:100%;height:100%” class=“slide-image” mode=“aspectFit” />
</swiper-item>
<swiper-item class=“swiper-item” style=“width:100%;height:100%”>
<image src=“http://picture.fiteam.mejimeji.net/guide-page/2.png” style=“width:100%;height:100%” class=“slide-image” mode=“aspectFit” />
</swiper-item>
<swiper-item class=“swiper-item” style=“width:100%;height:100%”>
<image src=“http://picture.fiteam.mejimeji.net/guide-page/3.png” style=“width:100%;height:100%” class=“slide-image” mode=“aspectFit” />
</swiper-item>
<swiper-item class=“swiper-item” style=“width:100%;height:100%”>
<image src=“http://picture.fiteam.mejimeji.net/guide-page/4.png” style=“width:100%;height:100%” class=“slide-image” mode=“aspectFit” />
</swiper-item>
</swiper>
<!-- <image src="/images/icons/enter_fiteam.png" class=‘enter’ mode=“aspectFit”></image> -->
</view>