美文网首页
小程序 高度计算

小程序 高度计算

作者: AbnerZhang | 来源:发表于2019-12-12 14:36 被阅读0次

    最近在研究小程序,遇到计算高度的问题, 随手记录下来:

    height: function() {

        var that = this;

        wx.getSystemInfo({

          success: function(res) {

            var clientHeight = res.windowHeight,//获取窗口高度px

              clientWidth = res.windowWidth,//获取窗口宽度px

              rpx_r = 750 / clientWidth;// px与rpx换算比例(ps:请自行搜索px和rpx换算)

            var height = clientHeight * rpx_r; // 窗口的高度rpx

          }

        });

      },

    相关文章

      网友评论

          本文标题:小程序 高度计算

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