zl程序教程

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

当前栏目

SAP Spartacus Loader Meta Reducer学习笔记 - loaderReducer

SAP笔记学习 Spartacus Meta loader reducer
2023-09-14 09:02:54 时间

链接:https://sap.github.io/spartacus-docs/loader-meta-reducer/#creating-actions

To give better feedback to users, based on their actions, we often have to keep information such as “cart is loading”, “fetching user address failed”, and so on.

为了给用户提供更好的用户体验,基于其在Spartacus上进行的动作,我们需要track诸如“Cart正在加载”,“读取用户地址信息失败”等信息。

For every separate application state, we have to keep that meta data beside. Separate for cart, user information, product data and so on. Implementing this logic in all of these places manually would result in having different solutions to the same problem across the codebase.

That’s why in spartacus loaderReducer was created.

例子:


leader.reducer.ts:

高阶reducer:

注意loader reducer和entity reducer的继承关系:

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