首页 > 解决方案 > 如何使用 Spartacus 中的插座覆盖/扩展 ProductGridItemComponent?

问题描述

我有一个案例,我应该ProductGridItemComponent在电子水疗基地站点覆盖/扩展它。通常,当在 Spartacus 中覆盖组件时,可以添加一个出口模板,如下所示:

<ng-template cxOutletRef="ProductGridItemComponent">
  My custom code here
</ng-template>

但这似乎没有任何效果。如果我尝试覆盖ProductListComponentis 工作,但我将不得不从源代码中复制大量代码以使其行为并看起来像 Spartacus 提供的代码。是否可以仅覆盖ProductGridItemComponent或者我必须覆盖ProductListComponent并从头开始构建它?

- 编辑 -

我在另一个线程上找到了答案。 如何在 Spartacus 中自定义较低级别的组件?

ProductGridItemComponent不可自定义。它必须在更高的水平上完成,ProductListComponent.

标签: spartacus-storefront

解决方案


它看起来没有ProductGridItemComponent可用的定制渠道。另一种方法是扩展和覆盖组件以自定义其行为。


推荐阅读