SAP Spartacus里的place holder Component - CMSFlexComponent

简介: SAP Spartacus里的place holder Component - CMSFlexComponent

For Angular or web components that do not need any data from CMS (for example, login), you can use the CMS component of type CMSFlexComponent as a placeholder.


This CMS component contains the special flexType attribute. Spartacus use the flexType attribute in its CMS mapping instead of the original component type.


具体体现在下面的代码里:


image.png


 for (const slot of source.contentSlots.contentSlot) {
      if (Array.isArray(slot.components?.component)) {
        for (const component of slot.components.component) {
          const comp: ContentSlotComponentData = {
            uid: component.uid,
            typeCode: component.typeCode,
          };
          if (component.properties) {
            comp.properties = component.properties;
          }
          if (component.typeCode === CMS_FLEX_COMPONENT_TYPE) {
            comp.flexType = component.flexType;
          } else if (component.typeCode === JSP_INCLUDE_CMS_COMPONENT_TYPE) {
            comp.flexType = component.uid;
          } else {
            comp.flexType = component.typeCode;
          }
          if (!target.page.slots[slot.position].components) {
            target.page.slots[slot.position].components = [];
          }
          target.page.slots[slot.position].components.push(comp);
        }
      }
    }

如果typeCode等于CMSFlexComponent,则flexType赋成Component的FlexTypeCode.


SAP Spartacus的CMS mapping逻辑里,使用Component的flexType字段。

image.png



如下图所示:

image.png

相关文章
|
12月前
|
缓存
关于 Spartacus ProdutList Component Service model$ 的填充逻辑
关于 Spartacus ProdutList Component Service model$ 的填充逻辑
|
12月前
|
JavaScript 前端开发
什么是 Spartacus 的 Video Component
什么是 Spartacus 的 Video Component
Spartacus 2211 无法在文件夹下使用 ng g component 创建新的 Component
Spartacus 2211 无法在文件夹下使用 ng g component 创建新的 Component
Spartacus 2211 无法在文件夹下使用 ng g component 创建新的 Component
|
12月前
|
JavaScript 容器
关于 SAP Spartacus generic-link component 的模板代码
关于 SAP Spartacus generic-link component 的模板代码
|
资源调度
SAP 电商云 Spartacus UI Component 级别的延迟加载实现(Lazy Load)
SAP 电商云 Spartacus UI Component 级别的延迟加载实现(Lazy Load)
|
容器
SAP 电商云 Spartacus UI Angular Component 动态创建的单步调试
SAP 电商云 Spartacus UI Angular Component 动态创建的单步调试
133 0
SAP 电商云 Spartacus UI Angular Component 动态创建的单步调试
|
Web App开发 JavaScript API
SAP 电商云 Spartacus UI 从 CMS 取回 slots 和 component 之后的处理
SAP 电商云 Spartacus UI 从 CMS 取回 slots 和 component 之后的处理
109 0
SAP 电商云 Spartacus UI 从 CMS 取回 slots 和 component 之后的处理
|
API 网络架构
如何找到 SAP 电商云 Spartacus UI 产品明细界面对应的 Angular 实现 Component 名称
如何找到 SAP 电商云 Spartacus UI 产品明细界面对应的 Angular 实现 Component 名称
112 0
如何找到 SAP 电商云 Spartacus UI 产品明细界面对应的 Angular 实现 Component 名称
|
JavaScript 安全
Angular 事件绑定语法在 SAP Spartacus Popover Component 中的一个应用
Angular 事件绑定语法在 SAP Spartacus Popover Component 中的一个应用
120 0
Angular 事件绑定语法在 SAP Spartacus Popover Component 中的一个应用
SAP Spartacus B2B user列表对应的Angular Component
SAP Spartacus B2B user列表对应的Angular Component
SAP Spartacus B2B user列表对应的Angular Component
下一篇
无影云桌面