为什么支付完成后返回页面storageSync被销毁了?
发布于 7 年前 作者 junxiang 14717 次浏览 来自 官方Issues

登录完成后登录信息存入storageSync中

return new Promise(function(resolve, reject) {

return login().then((res) => {

//登录远程服务器

util.request(api.AuthLoginByWeixin, {

code: res.code,

userInfo: userInfo

}, ‘POST’).then(res => {

if (res.errno === 0) {

//存储用户信息

wx.setStorageSync(‘resD’, res.data)

wx.setStorageSync(‘userInfo’, res.data.userInfo);

wx.setStorageSync(‘token’, res.data.token);

但是支付完成后返回页面请求storageSync,里面的数据就被清空了

onShow: function () {

var that = this

var loginToken =wx.getStorageSync(‘token’) //获取用户信息

console.log(‘登录的token’)

console.log(loginToken)

that.getOrderInfo()

},

如图中,输出为空

1 回复

你好,麻烦具体描述问题流程,提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部