Files
income_payments_applet/app.js
T

35 lines
809 B
JavaScript

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