简体   繁体   English

Javascript - 我无法创建我的灯箱,forEach 未定义

[英]Javascript - I can't create my lightbox, forEach is undefined

I have a problem with my lightbox, when I'm trying to link my lightbox folder (lightbox.js) to the photographerPage (photographerPage.js line 56), it says that "forEach" is undefined, and I don't know why.我的灯箱有问题,当我尝试将灯箱文件夹 (lightbox.js) 链接到摄影师页面(photographerPage.js 第 56 行)时,它说“forEach”未定义,我不知道为什么.

I don't know if someone can help me with that.我不知道是否有人可以帮助我。 Here is the code (GitHub Pages) : https://axsf3.github.io/FishEye/photographer-page.html?id=243这是代码(GitHub页面): https : //axsf3.github.io/FishEye/photographer-page.html? id =243

Thanks in advance.提前致谢。

Based on your code, it sounds like this.medias is not an array, which would cause forEach to be undefined, as that method is specific to the Array datatype.根据您的代码,听起来this.medias不是数组,这会导致forEach未定义,因为该方法特定于 Array 数据类型。

I'd recommend doing console.log(this.medias) to see what this.medias is giving back and what the current shape of the data is.我建议执行console.log(this.medias)以查看this.medias返回的内容以及数据的当前形状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM