app.ts 385 B

123456789101112131415161718
  1. // app.ts
  2. App<IAppOption>({
  3. globalData: {},
  4. onLaunch() {
  5. // 展示本地存储能力
  6. const logs = wx.getStorageSync('logs') || []
  7. logs.unshift(Date.now())
  8. wx.setStorageSync('logs', logs)
  9. // 登录
  10. wx.login({
  11. success: res => {
  12. console.log(res.code)
  13. // 发送 res.code 到后台换取 openId, sessionKey, unionId
  14. },
  15. })
  16. },
  17. })