spartacus documentaion指出,为了让smartedit正常工作,需要在index.html中提供webApplicationInjector.js脚本。
此外,需要使用smartedit实例列表设置值'data-smartedit-allow-origin‘。
如下所示:
<script id="smartedit-injector" src="webApplicationInjector.js" data-smartedit-allow-origin="localhost:9002"></script>但是什么是Prod-Environment的最佳实践呢?是否存在使用特定环境覆盖此值的构建过程?
因为我不想在index.html中列出所有可能的环境,包括本地主机。
任何帮助都将不胜感激。
非常感谢,朱利安
发布于 2020-02-05 03:03:54
您可以在angular环境模型中设置多个环境属性,请参阅https://angular.io/guide/build或有关的更多信息。然后,您需要动态添加smartedit注入器,并将环境属性考虑在内。您也可以使用这种方法延迟加载脚本,因为普通访问者不需要它。你可以在https://github.com/SAP/cloud-commerce-spartacus-storefront/issues/3805#issuecomment-543090561上阅读我们的计划。
发布于 2020-02-07 19:09:00
我更希望有一种类似于“occ-backend-base-url”的方法。
延迟加载运行良好。但是,app.component中还没有设置'launchInSmartEdit‘值,所以我们必须手动检查url中的’cx-app.component‘值。
但这确实起到了作用。
谢谢
https://stackoverflow.com/questions/60060006
复制相似问题