小程序中rpx转换成px

wx.getSystemInfo({
    success: function (res) {
        // console.log(res);
        // 可使用窗口宽度、高度
        // 计算主体部分高度,单位为px
        that.setData({
            // second部分高度 = 利用窗口可使用高度 - first部分高度(这里的高度单位为px,所有利用比例将300rpx转换为px)
            second_height: res.windowHeight - res.windowWidth / 750 * 197
        })
    }
})
发布了4 篇原创文章 · 获赞 3 · 访问量 5351

猜你喜欢

转载自blog.csdn.net/objdreammylife/article/details/82755427