zl程序教程

您现在的位置是:首页 >  其他

当前栏目

SAP Spartacus的持久化存储学习笔记

SAP存储笔记学习 Spartacus 持久
2023-09-14 09:02:54 时间

https://sap.github.io/spartacus-docs/configurable-state-persistence-and-rehydration/

Spartacus offers a mechanism to sync NGRX’s store slices to the specified browser’s storage - localStorage or sessionStorage.

ngrx的存储slice暂时同步到浏览器的storage里去:localStorage或者SessionStorage.

例子:购物车id:


access token也存储在内:

access_token_stored_at


In case there is a need to sync multiple slices of the state, just specify the required properties in storageSync’s keys config and specify the storage type.

需要同步多个state slice的情况如何做?

default-state-config.ts里定义的spartcacus-local-data, 也就是Chrome开发者工具里观察到的数据:

更多Jerry的原创文章,尽在:“汪子熙”: