微信安全区显示
微信小程序底部home键计算安全区
首先使用
wx.getWindowInfo()
微信获取屏幕(窗口)信息
top之涉及到是否有刘海
height是顶部到底部(不含home键)
用屏幕的总高度减去bottom即可
单位都是px
const windowInfo = wx.getWindowInfo()
console.log(windowInfo.pixelRatio) pixelRatio number 设备像素比
console.log(windowInfo.screenWidth)
console.log(windowInfo.screenHeight)
console.log(windowInfo.windowWidth)
console.log(windowInfo.windowHeight)
console.log(windowInfo.statusBarHeight)
console.log(windowInfo.safeArea)
console.log(windowInfo.screenTop)
本文来自博客园,作者:jialiangzai,转载请注明原文链接:https://www.cnblogs.com/zsnhweb/articles/17645192.html

浙公网安备 33010602011771号