美文网首页SAP
SAP Commerce Cloud Spartacus UI

SAP Commerce Cloud Spartacus UI

作者: 华山令狐冲 | 来源:发表于2021-10-22 09:14 被阅读0次

在 components.reducer.ts 里,loaderReducer 函数,会根据输入的 entityType,返回一阶 reducer.

然后在代码第86行,调用该一阶 reducer 进行状态转换,返回新的状态。

在 cms store reducers index.ts 里,该 reducer 被导入,见代码第21行:

然后,在第49行,调用 entityReducer,给 COMPONENT_ENTITY 类型生产一个新的 reducer 函数。

这个新的 reducer 的函数体:

getReducer 在何时会被调用?

除了 index.ts 之外,其他都是单元测试代码:


通过工厂方法 + injection token 的方式暴露给外部:

最后被导入到 CmsStore module 的 providers 区域里即可:

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


相关文章

网友评论

    本文标题:SAP Commerce Cloud Spartacus UI

    本文链接:https://www.haomeiwen.com/subject/pbmkgltx.html