关于 SAP Spartacus low level Component的customization
一些讨论链接:https://stackoverflow.com/questions/62157099/how-to-customize-lower-level-components-in-spartacus/
需求
I’m trying to customize the ProductListItemComponent and the ProductGridItemComponent in order to add some more functionality like a Stock counter.
解决方案
You are right! You can’t customize ProductListItemComponent or ProductGridItemComponent via remapping it like a CMS Component, you should customize it over higher lever CMS Component - ProductListComponent.
从产品层面解决:Enable outlet for “product tile”: ProductListItemComponent and ProductGridItemComponent
需求issue:
https://github.com/SAP/spartacus/issues/4231
Introduce dynamic loading of static components similarly to CMS component loading
架构
Currently we have two approaches to customise the default experience that Spartacus brings:
Spartacus 提供了两种 UI 扩展方式
CMS components are rendered based on the CMS component type and the JS component which is mapped to it.
Outlets provide a mechanism to replace or amend a component.
CMS components are only used for bigger pieces of the screen that must be controlled by business (either in SmartEdit or using personalisation).
其中,CMS Component提供了粗粒度的,从业务层面驱动和控制的屏幕定制化。
Outlets could be applied in a more fine-grained way, but they pollute the code. This is why they’ve been only used so-far in a generic way, i.e. when a page, slot or component is rendered dynamically.
而outlet提供了更加细粒度的定制化方式,付出的代价就是,outlet是侵入式的,因此污染了部分代码。因此,只出现在当 SAP Spartacus 的 page, slot 或者 Component 被动态渲染时。
愿景
Instead of adding a large number of outlets to the code base, we like to introduce a concept that can be applied to any static component; very similar to how we map a CMS component to a JS component, we could map any JS component.
技术调整
理想很丰满,现实很骨感。
Dynamic components seems not to be the first class citizens in the Angular’s world.
Dynamic Component 不是 Angular 里的一等公民。
You can create a component dynamically thanks to Angular API, but then you have to maintain manually all the following operations for the life of the component:
- update inputs
- calculate input’s changes
- trigger the lifecycle hook ngOnChanges (related to above)
- trigger change detection markForCheck
- subscribe to outputs and trigger callbacks
- bind DOM attributes
- bind DOM events
这个前沿性的研究,记录在这个链接Introduce dynamic loading of static components similarly to CMS component loading里。
关于 SAP Spartacus low level Component的customization相关推荐
- SAP Spartacus维护CMS Component到Angular Component的源代码位置
Spartacus界面上的banner,如下图所示,对应着HTML源代码里的cx-banner标签: cx-banner下面是cx-generic-link: 这个cx-generic-link包含一 ...
- 如何找到 SAP Spartacus 里某个 Component TypeScript 编译后生成的 JavaScript 位置
需求 如何找到触发该网络请求的准确代码位置? 从 initiator 里查看调用栈上下文,一点头绪也没有. 找到触发该网络请求的控件的 selector:cx-register 在 Storefron ...
- SAP Spartacus Unit List Component的设计明细 - UnitListComponent
Unit list Component 源代码: 这个service是依赖注入的: this.service指向unit list specific service class: 在这个specifi ...
- SAP Spartacus后台CMS Component和Angular Component的映射关系
a skeleton using CMS Components from backend: ConfigModule.withConfig({cmsComponents: {SimpleRespons ...
- SAP Spartacus单元测试里Component实例的创建细节
启动命令:ng test storefrontlib 单元测试里,使用TestBed创建Component实例的源代码: 首先在Chrome开发者工具里找到单元测试用例的实现源代码: 在_karma_ ...
- SAP Spartacus 的 Banner Component 请求
我在我的自定义Component里将observable数据用console.log打印出来: 这些banner的typecode都为SimpleResponsiveBannerComponent: ...
- SAP Spartacus Delivery Mode Component单元测试的Mock设计图
- SAP 电商云 Spartacus UI Angular Component 动态创建的单步调试
Jerry 之前的文章SAP 产品 UI 里的容器组件的概念和开发概述介绍过,SAP Spartacus Angular Component,通过我们开发团队自定义的指令 cxComponentWra ...
- SAP Spartacus 懒加载 Customized CMS Component 的问题
Lazy-loaded overriden or custom CMS Components SAP Spartacus 有两种 lazy load 方式: CMS-driven lazy loadi ...
最新文章
- 解决Word 2013, Word 2016的保存太慢的问题
- MAC Pro 同时安装 Python2 和 Python3
- Windows 10 中 Eclipse中无法添加Courier New字体的解决方法!
- C++large fibonacci大斐波那契数列的实现(附完整源码)
- 深度学习系统相比较传统的机器学习系统,针对常见的分类问题,精度究竟能有多大提升?...
- Linux-破解rhel7-root密码
- mysql 范式化_MySQL-范式和反范式
- golang如何生成随机数
- oracle查看数据库是否恢复成功_【新书连载】测试工程师核心开发技术(9)—数据库常用管理命令...
- 比尔·盖茨录视频祝大家“新春快乐
- 让IT不加班,让业务不等待,一文讲透自助式分析的前世今生
- CodeReview 常见代码问题( 下 )
- 24岁女孩与30岁男人的精彩对白
- GBK编码转换及Md5算法工具
- 性能测试详解(三)Tomcat性能调优
- linux有类似酷狗qq音乐软件,除了网易云QQ音乐,这些小众音乐APP同样值得推荐。...
- Science| 深度解析肠道菌群与肥胖
- 【119天】尚学堂高琪Java300集视频精华笔记(24-30)
- 【Redis Docker容器安全性防护,防止入侵】
- [198].打家劫舍