为什么 vuex 的 store state 没有存储在 localStorage 中?
Why is the store state of the vuex not stored in localStorage?
当我刷新页面时,商店的状态全部消失了。
这在编程时很不方便
一抬头,有个模块叫vuex-persist,它把vuex的状态存储在localStorage中。
为什么vuex默认不把vuex的状态存储在cookie或者localStorage中?
而且,使用 vuex-persist 模块存储 store 的状态会有什么副作用吗?
Why doesn't vuex store the state of vuex by default in cookie or localStorage?
Vuex 是一个状态管理库。在大多数情况下,状态将从 API 或数据库中部分填充。保持该状态不是 Vuex 的责任。
Will there be any side effects of storing the state of the store using the vuex-persist module?
这取决于你的应用是什么,但不应该
请注意本地存储的大小,它很大但不是无限的。
当我刷新页面时,商店的状态全部消失了。
这在编程时很不方便
一抬头,有个模块叫vuex-persist,它把vuex的状态存储在localStorage中。
为什么vuex默认不把vuex的状态存储在cookie或者localStorage中?
而且,使用 vuex-persist 模块存储 store 的状态会有什么副作用吗?
Why doesn't vuex store the state of vuex by default in cookie or localStorage?
Vuex 是一个状态管理库。在大多数情况下,状态将从 API 或数据库中部分填充。保持该状态不是 Vuex 的责任。
Will there be any side effects of storing the state of the store using the vuex-persist module?
这取决于你的应用是什么,但不应该
请注意本地存储的大小,它很大但不是无限的。