美文网首页
微信小程序中苹果ios固定定位position:fixed失效b

微信小程序中苹果ios固定定位position:fixed失效b

作者: Kser | 来源:发表于2019-04-01 13:13 被阅读0次

    网上资料解决杂乱不一,特意一补

    为page标签设置wxss样式

    overflow-y: hidden;overflow-x:hidden;

    然后在wxml中设置标签

    <!--固定定位不动的内容-->

    ......

    <!--需要上下左右滑动的内容-->

    <scroll-view style="height: {{windowHeight}}px; width:{{windowWidth}}px;" scroll-y="true" scroll-x="true">

    .......

    </scroll-view>

    在wxml中的两个变量js中设置(自己可以调整scroll-view宽高,我这里循例发出来给你们看而已)

    var page_this = this;

    wx.getSystemInfo({

        success: (res) => {

            page_this.setData({

              windowHeight: res.windowHeight,

              windowWidth: res.windowWidth,

              windowIsBang: (res.windowWidth/res.windowHeight<0.5 ? true : false)//判断手机是否有刘海屏

            })

        }

    })

    相关文章

      网友评论

          本文标题:微信小程序中苹果ios固定定位position:fixed失效b

          本文链接:https://www.haomeiwen.com/subject/dcfvbqtx.html