SAP Spartacus里cx-carousel的实现
发布日期:2021-06-30 14:32:41 浏览次数:2 分类:技术文章

本文共 606 字,大约阅读时间需要 2 分钟。

实现源代码:

cx-carousel Component的几个属性:

  • items
  • title
  • template

进到carousel的实现文件里:

storefrontlib\src\shared\components\carousel\carousel.component.ts

items的类型:Observable数组

template属性:

cx-carousel本身作为一个reuse library,它不知道template应该如何渲染,因此需要cx-carousel的consumer,在这个例子里即product-carousel.component.html在消费时将自己的template通过template属性传入:

carousel里的carousel-panel:

运行时:

div的层级结构:

运行时:div class = slides,slide,item

这里可以看到辅助信息,ng-reflect-ng-if显示出运行时if的评估条件:true

这个normalizeDebugBindingName比较有用:

normalizeDebugBindingValue(value);

这里将消费端指定的template属性绑定到carousel ng-container的*ngTemplateOutlet属性里:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

转载地址:https://jerry.blog.csdn.net/article/details/108834106 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:SAP Spartacus里Product Carousel componentData取数据的逻辑研究
下一篇:Angular里使用createEmbeddedView的单步调试

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2024年04月07日 22时26分53秒