Spartacus-自定义标题和类别导航

问题描述

我需要在spartacus店面标头和导航上进行自定义配置。布局元素的分发方式必须与Spartacus的默认结构完全不同。

我已经制作了一个自定义组件来配置类别导航,并且按预期将其成功注入到默认strucutre中。该组件内部的重要部分如下:

  node$: Observable<NavigationNode> = this.service.getNavigationNode(
    this.componentData.data$
  );

  data$: Observable<CmsNavigationComponent> = this.componentData.data$;

  constructor(protected componentData: CmsComponentData<CmsNavigationComponent>,protected service: NavigationService) {
  }

请注意,我使用this one之类的 CmsComponentData 方法,但是问题在于标头包含我要删除的元素,因此可以实现所需的结构。那就是技巧部分,因为我认为可行的一种方法是替换整个标头,并仅用我需要的元素来构建它,如下所示(找到here):

<ng-template cxOutletRef="cx-header">
  <app-custom-category-navigation></app-custom-category-navigation>
</ng-template>

但是,这样做必须使用自定义导航组件,在这种情况下,CMS ComponentData注入器不起作用,并抛出“ 没有CmsComponentData提供程序!”错误。有人可以让我朝正确的方向前进吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...