spartacus-storefront - 即使没有设置 url,Spartacus 元标记也会被配置覆盖
问题描述
我在 CCv2 环境中设置了 Spartacus v2 (Hybris 2005)。我目前面临的问题是元标记的内容<meta name="occ-backend-base-url" content="OCC_BACKEND_BASE_URL_VALUE" />
在我的任何环境中都没有被替换。
发生这种情况是因为我需要将 app.module.ts 中的 occ 前缀设置为 hybris 2005:
backend: {
occ: {
prefix: '/occ/v2/'
}
}
是否有针对此问题的仅前端解决方案,或者我们是否需要在后端将前缀更改回 /rest/v2?
即使在 backend.occ 数据对象中没有定义 url,但只有前缀,元标记是否会被忽略?
索引.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Spartacusstore</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="manifest" href="manifest.webmanifest">
<meta name="theme-color" content="#1976d2">
<meta name="occ-backend-base-url" content="OCC_BACKEND_BASE_URL_VALUE" />
</head>
<body>
<app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body>
</html>
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { translations, translationChunksConfig } from '@spartacus/assets';
import { B2cStorefrontModule } from '@spartacus/storefront';
import { OccConfig, I18nModule, TranslatePipe } from '@spartacus/core';
const occConfig: OccConfig = { backend: { occ: {} } };
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
B2cStorefrontModule.withConfig({
backend: {
occ: {
prefix: '/occ/v2/'
}
},
checkout: {
guest: true
},
context: {
currency: ['USD'],
language: ['en'],
baseSite: ['electronics-spa']
},
i18n: {
resources: translations,
chunks: translationChunksConfig,
fallbackLang: 'en'
},
features: {
level: '2.0'
},
}),
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
解决方案
推荐阅读
- javascript - 胜利图,如何更改轴和标签颜色
- node.js - 如何在浏览器化脚本中使用传递给 index.jade 的对象?
- node.js - 使用 Cloud Functions 将数据写入 Firestore
- python - Elasticsearch:字段相对于其他字段的分布
- r - R Project - 如何改变控制台文本的颜色?
- google-cloud-platform - 在 Google Compute Engine 上将 Debian 8 升级到 9 的正确方法是什么?
- javascript - 如何在nodejs中重复执行
- python - Pandas遍历行,将列值与列表中的字符串进行比较,从另一列返回值
- python - 表单验证评估为 False Flask
- c++ - 警告隐式转换丢失整数精度