// app.js App({ onLaunch() { // 展示本地存储能力 const logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) // wx.getStorage({ // key: 'X-Access-Token', // success: (res) =>{// 缓存中登录过,直接进小程序 // wx.switchTab({ // url: 'pages/home/home', // }) // }, // fail: function(){ // // 缓存中没有登录过默认app.json的登录页 // } // }) // 登录 wx.login({ success: res => { // 发送 res.code 到后台换取 openId, sessionKey, unionId } }) }, globalData: { userInfo: null } })