1.在小程序onLaunch生命周期函数中获取全局用户信息,打印该信息:

3.完整代码:
App({ onLaunch: function() { var user = wx.getStorageInfoSync("userInfo"); console.log(user) if (user.keys.length0) { wx.switchTab({ url: 'pages/index/index/index', }) } else { wx.redirectTo({ url: 'pages/splash/splash', }) } },})














