1234567891011121314151617181920212223242526272829303132333435 |
- // app.js
- App({
- onLaunch() {
- // 展示本地存储能力
- const logs = wx.getStorageSync('logs') || []
- logs.unshift(Date.now())
- wx.setStorageSync('logs', logs)
- //获取顶部navBar的信息
- const that = this;
- // 获取系统信息
- const systemInfo = wx.getSystemInfoSync();
- // 胶囊按钮位置信息
- const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
- that.globalData.windowWidth = systemInfo.windowWidth
- that.globalData.windowHeight = systemInfo.windowHeight
- // 导航栏高度 = 状态栏高度 + 44
- that.globalData.navBarHeight = systemInfo.statusBarHeight + 44;
- that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
- that.globalData.menuTop = menuButtonInfo.top;
- that.globalData.menuHeight = menuButtonInfo.height;
- that.globalData.menuWidth = menuButtonInfo.width;
- },
- globalData: {
- userInfo: null,
- navBarHeight: 0, // 导航栏高度
- menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
- menuTop: 0, // 胶囊距顶部间距
- menuHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
- menuWidth:0,
- windowHeight:0,
- windowWidth:0,
- imghttp:'http://192.168.1.7:8801/'
- }
- })
|