Javascript 未捕获类型错误:无法读取未定义的属性[';src';]

Javascript 未捕获类型错误:无法读取未定义的属性[';src';],javascript,Javascript,//添加图像 var纵横比=“”; var itemImagesHtml=''; itemImagesHtml+='0){ 纵横比=图像[0]['width']/图像[0]['height']; itemImagesHtml+=1/纵横比*100; }否则{ itemImagesHtml+=100; } itemImagesHtml+='%;">'; itemImagesHtml+=''; itemImagesHtml+=''; itemImagesHtml+='' var image\u si

//添加图像 var纵横比=“”; var itemImagesHtml=''; itemImagesHtml+='0){ 纵横比=图像[0]['width']/图像[0]['height']; itemImagesHtml+=1/纵横比*100; }否则{ itemImagesHtml+=100; } itemImagesHtml+='%;">'; itemImagesHtml+=''; itemImagesHtml+=''; itemImagesHtml+=''

var image\u size=bcsfilterconfig.custom.max\u height+'x'+bcsfilterconfig.custom.max\u height;
var max_width=images.length>0?bcsfilterconfig.custom.max_height*纵横比:0;
itemImagesHtml+='';
itemHtml=itemHtml.replace(/{{itemImages}}}/g,itemImagesHtml);

看起来像
图像
它是一个数组,并且此数组中的第二个项目没有定义:
图像[1]['src']
。只需确保此数组中有第二个项目

这里是图像[1]似乎未定义。很可能您正在尝试访问图像数组的索引1,但该索引不存在。

请共享
图像的内容
并共享一个工作片段来演示您的问题。请显示已编辑图像的详细代码请再次检查是的,我实际上有相同的代码在其他页面上工作正常
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);