Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APP.JSX中使用taro.setStorageSync存储参数,在子页面中使用Taro.getStorageSync首次打开页面的时候没获取到数据,再次打开页面才有 #5745

Closed
dzlishen opened this issue Mar 20, 2020 · 4 comments
Assignees

Comments

@dzlishen
Copy link

问题描述

APP.JSX中使用taro.setStorageSync存储参数,在子页面中使用Taro.getStorageSync首次打开页面的时候没获取到数据,再次打开页面才获取到数据。

  1. 在app.jsx中的componentWillMount,使用taro.setStorageSync存储参数。通过分享打开小程序的子页面时在componentWillMount使用Taro.getStorageSync未能获取到数据。但是关闭页面再次点击又获取到了数据。
Taro.setStorageSync('token', res.data.token)

var token = Taro.getStorageSync('token')
@taro-bot
Copy link

taro-bot bot commented Mar 20, 2020

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Mar 20, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@HungryBird
Copy link

同一个问题 要刷新才能取到数据...

@fred8617
Copy link
Contributor

fred8617 commented Jul 3, 2020

我好像也遇到了这个问题,用户总说需要重新登录

@Chen-jj Chen-jj closed this as completed Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants