//添加图片 var aspect_ratio =''; var itemImagesHtml =''; itemImagesHtml + ='0){ aspect_ratio = images [0] ['width'] / images [0] ['height']; itemImagesHtml + = 1 / aspect_ratio * 100; } else { itemImagesHtml + = 100; } itemImagesHtml + ='%;“>'; itemImagesHtml + =''; itemImagesHtml + =''; itemImagesHtml + ='';
var image_size = bcSfFilterConfig.custom.max_height + 'x' + bcSfFilterConfig.custom.max_height;
var max_width = images.length > 0 ? bcSfFilterConfig.custom.max_height * aspect_ratio : 0;
itemImagesHtml += '<noscript><img class="grid-view-item__image" src="' + this.getFeaturedImage(images, image_size + '@2x') + '" alt="{{itemTitle}}" style="max-width: ' + max_width + 'px;"></noscript>';
itemHtml = itemHtml.replace(/{{itemImages}}/g, itemImagesHtml);
答案 0 :(得分:0)
看起来images
它是一个数组,并且未定义此数组中的第二项:images[1]['src']
。只需确保您拥有此数组中的第二项
答案 1 :(得分:0)
这里,图像[1]似乎未定义。您很可能正在尝试访问图像数组的索引1,但这并不存在。