| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- // pages/privacy/index.js
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- // 状态栏高度
- statusBarHeight:'',
- // 导航栏高度
- navBarHeight:'',
- // 导航栏和状态栏高度
- navStatusBarHeight: '',
- // 胶囊
- menu:'',
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
-
- this.setData({
- statusBarHeight:wx.getStorageSync('statusBarHeight'),
- navBarHeight: wx.getStorageSync('navBarHeight'),
- navStatusBarHeight:wx.getStorageSync('navStatusBarHeight'),
- menu:wx.getStorageSync('menu')
- })
- },
- getShowScreenHeight(){
- //系统信息
- const systemInfo = wx.getWindowInfo()
- //胶囊位置
- const capsuleInfo = wx.getMenuButtonBoundingClientRect()
- //计算导航栏高度
- let navHeight = systemInfo.statusBarHeight + capsuleInfo.height + (capsuleInfo.top - systemInfo.statusBarHeight) * 2
- //计算tabbar高度
- let tabHeight = systemInfo.safeArea.bottom - systemInfo.safeArea.height
- //计算可现实内容高度(中间区域)
- // let screenHeight = systemInfo.screenHeight-navHeight-tabHeight-30
-
-
- const menu = wx.getMenuButtonBoundingClientRect()
- wx.setStorageSync('menu', menu)
- // 手机系统状态栏高度
- wx.setStorageSync('statusBarHeight', tabHeight)
- // 导航栏高度
- wx.setStorageSync('navBarHeight', menu.height+(menu.top-systemInfo.statusBarHeight) *2 )
-
- // 状态栏加导航栏
-
- wx.setStorageSync('navStatusBarHeight',navHeight)
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
-
- }
- })
|