SAP Spartacus CMSFlexComponent
對于不需要來自 CMS 的任何數據(例如,登錄)的 Angular 或 web 組件,您可以使用 CMSFlexComponent 類型的 CMS 組件作為占位符。 這個 CMS 組件包含特殊的 flexType 屬性。 Spartacus 在其 CMS 映射中使用 flexType 屬性而不是原始組件類型。
同理,CMS映射中使用的是JspIncludeComponent的uid屬性,而不是原來的組件類型。
注意:建議使用 CMSFlexComponent 而不是 JspIncludeComponent,因為 JspIncludeComponent 中的 uid 屬性必須是唯一的,這意味著不能有同一個 JspIncludeComponent 的兩個實例。
CMSFlexComponent 字符串定義成常量 CMS_FLEX_COMPONENT_TYPE 的值:
在 occ-cms-page-normalizaer.ts 文件的 normalizePageComponentData 方法里設置斷點:
準備被 normalizer 處理的源數據結構:
每個 page 有多個 contentSlot,每個 slot 包含了多個 Component:
target 結構:source 結構中 slot 的 position 值,作為 target 結構的 key:
最后 target 結構中每個 Component 元素,只存在三個屬性:uid,typeCode 和 flexType:
更多Jerry的原創文章,盡在:“汪子熙”:
總結
以上是生活随笔為你收集整理的SAP Spartacus CMSFlexComponent的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SAP Spartacus Sample
- 下一篇: SAP Spartacus API 的事