wx.getSystemInfo({
      success: function (res) {
        that.globalData.winWidth = res.windowWidth;
        that.globalData.winHeight = res.windowHeight;
      }
    })

 

以上,app.js中 先获取整体高度 赋值给全局变量

<swiper class='swiper' current="{{currentTab}}" duration="300" bindchange="bindChange" style="height:{{winHeight}}px">

以上.wxml代码 style height 赋值 使用方法

 

//定义高度
Page({
  data: {
    winHeight: 0
 },
})

onLoad: function (options) {
 this.setData({
      winHeight: app.globalData.winHeight -                    
                            wx.getSystemInfoSync().screenWidth / 750 * (155)
    })
}

以上 js 是其他控件预留 155rpx情况下

swiper 控件的高度

 

 

相关文章:

  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
  • 2021-12-05
  • 2021-07-06
  • 2022-12-23
猜你喜欢
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案