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