1

错误类型错误:product.images.GALLERY.map 不是函数

访问产品详情页面时,在 Spartacus 3.0 Telco(TUA) 中,出现以下异常:

"ERROR TypeError: product.images.GALLERY.map is not a function",指文件路径下的产品缩略图:storefrontlib\src\cms-components\product\product-images\product-images.component.ts.

调试在方法上出现此问题的方法: createThumbs(product)- 出现在 @spartacus 包中,这是因为它在 Object 类型值上调用 .map() 函数。

截图

截图 1 - 异常时刻

屏幕截图 2 - 异常行和方法

卷发/产品
curl --location --request GET '{{backend}}/occ/v2/telcospa/products/4803521?fields=code,name,summary,price(formattedValue,DEFAULT),images(galleryIndex,FULL),DEFAULT,averageRating,stock(DEFAULT),description,availableForPickup,url,numberOfReviews,manufacturer,categories(FULL),priceRange,multidimensional,configuratorType,configurable,tags,productOfferingPrice(FULL),productSpecification,validFor&lang=en&curr=USD' \
--header 'Connection: keep-alive' \
--header 'Pragma: no-cache' \
--header 'Cache-Control: no-cache' \
--header 'X-Anonymous-Consents: %5B%5D' \
--header 'Accept: application/json, text/plain, */*' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Edg/91.0.864.59' \
--header 'sec-ch-ua: " Not;A Brand";v="99", "Microsoft Edge";v="91", "Chromium";v="91"' \
--header 'Origin: {{backend}}' \
--header 'Sec-Fetch-Site: same-site' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Referer: {{backend}}' \
--header 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
包.json
{
  "name": "tua-spartacus",
  "version": "0.0.1-51",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --disable-host-check",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/core": "^10.1.0",
    "@angular-devkit/schematics": "^10.1.0",
    "@angular/animations": "~10.1.0",
    "@angular/common": "~10.1.0",
    "@angular/compiler": "~10.1.0",
    "@angular/core": "~10.1.0",
    "@angular/forms": "~10.1.0",
    "@angular/localize": "^10.1.6",
    "@angular/platform-browser": "~10.1.0",
    "@angular/platform-browser-dynamic": "~10.1.0",
    "@angular/platform-server": "~10.1.0",
    "@angular/router": "~10.1.0",
    "@angular/service-worker": "~10.1.0",
    "@ng-bootstrap/ng-bootstrap": "^7.0.0",
    "@ng-select/ng-select": "^5.0.9",
    "@ngrx/effects": "~10.0.0",
    "@ngrx/router-store": "~10.0.0",
    "@ngrx/store": "~10.0.0",
    "@schematics/angular": "^10.1.0",
    "@spartacus/assets": "~3.0.0",
    "@spartacus/core": "~3.0.0",
    "@spartacus/storefront": "~3.0.0",
    "@spartacus/styles": "~3.0.0",
    "@spartacus/tua-spa": "~3.0.0",
    "angular-oauth2-oidc": "^10.0.1",
    "bootstrap": "^4.2.1",
    "chart.js": "^2.9.3",
    "express": "^4.15.2",
    "i18next": "^19.3.4",
    "i18next-xhr-backend": "^3.2.2",
    "jquery": "^3.5.1",
    "material-design-icons": "^3.0.1",
    "ng2-charts": "^2.3.2",
    "ngx-infinite-scroll": "^8.0.0",
    "ngx-mask": "^11.1.5",
    "ngx-spinner": "^10.0.1",
    "parse5": "^6.0.1",
    "popper.js": "^1.16.1",
    "rxjs": "^6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1002.3",
    "@angular/cli": "~10.2.3",
    "@angular/compiler-cli": "~10.1.0",
    "@angular/language-service": "~10.1.0",
    "@spartacus/schematics": "~3.0.0",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.2",
    "jasmine-core": "^3.7.1",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.7"
  }
}
4

0 回答 0