https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html
写在app.js里了 随时可以调用
onShow: function (options) {
console.log("app-onShow");
let that = this;
//显示客服入口
// 获取系统参数
wx.getSystemInfo({
success: res => {
console.log(res)
that.globalData.screenWidth = res.screenWidth;
that.globalData.screenHeight = res.screenHeight;
}
})
}
data: {
screenWidth: app.globalData.screenWidth,
},
<swiper indicator-dots="true" autoplay="true" interval="2000" duration="500" indicator-color="rgba(0,0,0,0.5)" indicator-active-color="red" circular="true" style='height:{{screenWidth * 0.48}}px'>
<block wx:for="{{list}}" wx:key='*this'>
<swiper-item>
<image src="{{item.image}}" mode='aspectFill' class="slide-image" style="width: 100%;height:{{screenWidth * 0.48}}px"/>
</swiper-item>
</block>
</swiper>