// app.ts App({ globalData: { /// iPhone底部安全区域 safeBottom: 0, /// 窗口高度 windowHeight: 0 }, onLaunch() { /// 获取iPhone底部安全区域 wx.getSystemInfo({ success: res=> { console.log(res) this.globalData.safeBottom = res.screenHeight-res.safeArea.bottom this.globalData.windowHeight = res.windowHeight }, fail(err) { console.log(err) } }) // 展示本地存储能力 const logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) // 登录 wx.login({ success: res => { console.log(res.code) // 发送 res.code 到后台换取 openId, sessionKey, unionId }, }) }, })