小程序屏幕各区域高度

const windowInfo = wx.getWindowInfo()
console.log(windowInfo)
const menu = wx.getMenuButtonBoundingClientRect();
console.log(menu)

// 屏幕高度
var screenHeight = windowInfo.screenHeight;

//窗口高度
var windowHeight = windowInfo.windowHeight;

// 状态栏高度
var statusBarHeight = windowInfo.statusBarHeight;

// 导航栏高度
var navBarHeight = menu.height + (menu.top - statusBarHeight) * 2;

// 胶囊高度
var capsuleHeight = menu.height;

//底部导航栏高度
var bottomBarHeight = screenHeight-windowHeight-statusBarHeight-navBarHeight;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容