- SAP UI5 sap.ui.vk 命名空间内的控件介绍
- SAP 电商云 Spartacus UI 的 Product C
- SAP 电商云 Spartacus UI 产品搜索结果的设计明细
- SAP 电商云 Spartacus UI 从 CMS 取回 sl
- 网站上的 breadcrumb 使用场景浅析
- 在 SAP 电商云 Spartacus UI 里使用自定义配置控
- HTML 按钮(button)的 disable 属性和 dis
- SAP 电商云 Spartacus UI 里如何捕捉语言设置的更
- SAP 电商云 Spartacus UI Proxy Facad
- Angular @Injectable 注解的工作原理浅析
在 page-slot.module.ts 里,定义一个配置对象 ConfigUIDebug.

这个配置对象定义在 cms-component-data.ts 的 ConfigUIDebug 对象里,包含一个 boolean 类型字段:switchOn

通过:
providers: [provideDefaultConfigFactory(jerryConfigFactory)],

注入到 injection token 里:

给 DefaultConfigChunk 提供了运行时实现。
这样,在运行时,PageSlotComponent 就可以在构造函数里注入全局 Config 对象,进而访问到字段 switchOn 的值。

最后在 PageSlotComponent html 页面实现里,使用这个开关:

关闭这个开关的 UI:

打开之后的 UI:

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

网友评论