-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
当我刷新浏览器地址的时候,state里面的内容被清空了。 #47
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
Comments
刷新相当于App重载了 数据当然会清空 你可以把数据存在cookie, session或者localstorage |
@jianfei 如果这样子的话,我感觉vuex意义不大了啊。 |
@shinygang 你是不是理解错 vuex 的意义了... |
@yyx990803 我理解的是用vuex做全局状态管理,比如登录后的一些用户信息全局缓存,不用在组件的props上传了。我想用他来替代localStorage之类的本地缓存。 |
状态管理是为了可维护性和可扩展性,和本地缓存没有任何关系。但是你可以在 middleware 中将状态存入 localStorage。
|
楼主,vuex刷新给清楚了是什么回事!! |
@yyx990803 有道理 |
hi all,
我们项目中最近准备引用vuex,但是发现一个问题:当我刷新浏览器地址的时候,state里面保存的数据被清空了。请指导一下怎么解决。
The text was updated successfully, but these errors were encountered: