SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

分别是header,navigation和footer:

SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

其中每个section里包含的slots,定义在文件layout-config.ts里:

SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

运行时打印的输出:

SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

Storefront.component.html的cx-page-layout design time:

SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

运行时的callstack:

SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

这个section有@Input注解:

Decorator that marks a class field as an input property and supplies configuration metadata. The input property is bound to a DOM property in the template. During change detection, Angular automatically updates the data property with the DOM property’s value.

该input property绑定到DOM property,其值来自DOM元素的对应属性。

SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

section$是一个BehaviorSubject,通过next函数将section的值传递给其他subscriber:

SAP Spartacus Storefront页面cx-page-layout的赋值逻辑

更多Jerry的原创文章,尽在:“汪子熙”:
SAP Spartacus Storefront页面cx-page-layout的赋值逻辑