spartacus-storefront - 如何使用 Spartacus 中的插座覆盖/扩展 ProductGridItemComponent?
问题描述
我有一个案例,我应该ProductGridItemComponent
在电子水疗基地站点覆盖/扩展它。通常,当在 Spartacus 中覆盖组件时,可以添加一个出口模板,如下所示:
<ng-template cxOutletRef="ProductGridItemComponent">
My custom code here
</ng-template>
但这似乎没有任何效果。如果我尝试覆盖ProductListComponent
is 工作,但我将不得不从源代码中复制大量代码以使其行为并看起来像 Spartacus 提供的代码。是否可以仅覆盖ProductGridItemComponent
或者我必须覆盖ProductListComponent
并从头开始构建它?
- 编辑 -
我在另一个线程上找到了答案。 如何在 Spartacus 中自定义较低级别的组件?
ProductGridItemComponent
不可自定义。它必须在更高的水平上完成,ProductListComponent
.
解决方案
它看起来没有ProductGridItemComponent
可用的定制渠道。另一种方法是扩展和覆盖组件以自定义其行为。
推荐阅读
- python - QMouseEvent' 对象没有属性 'pos'
- vue.js - Vue 过渡:侧边栏过渡但不退出
- lua - kong manager登录时出现意外错误
- python - 我想计算这张图片中划定的手掌数量
- r - R中Excel文件的唯一文件ID
- r - RShiny 部署错误:值错误[[3L]](cond):无法安装包
- rust - Rust Deref vs 在内部类型上实现迭代器
- python - 超过 5 年的 Alpha Vantage 基本数据(损益表、资产负债表、现金流)
- rust - Rust:由于需求冲突,无法为 autoref 推断出合适的生命周期
- hazelcast - Hazelcast:搜索结果很大时的缓慢/阻塞