解决小程序页面底部块设置fixed,ios下拉出现回弹遮盖底部块的问题

这个问题我的解决方式是,安卓因为没有问题,所以不改变,而ios出现问题,在被遮盖地方的最外层父级标签加上padding-bottom:xxx;

判断系统型号,这里我是写在app.js里面,也可以单独调用

 app.js:
 wx.getSystemInfo({
                success: function (a) {
                  var w = a.screenWidth;
                  var h = a.screenHeight;
                  var phoneSystem = a.platform;
                  getApp().globalData.mHeight = h;
                  getApp().globalData.mWidth = w;
                  getApp().globalData.phoneSystem = phoneSystem;
                }
              });

页面的js,因为默认底部有20rpx

data:{
	 iosPaddingBottom:20
},
  onShow: function () {
    let pg = this;
    if(getApp().globalData.phoneSystem.indexOf('ios') >= 0){
      pg.setData({
        iosPaddingBottom : 120
      });
    }

wxml

  <view class="pictureremark" style="padding-bottom: {{iosPaddingBottom}}rpx;">...

猜你喜欢

转载自blog.csdn.net/qq_38188047/article/details/104942199
今日推荐