Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'forEach' of undefined #44

Closed
ttly20 opened this issue Oct 16, 2018 · 2 comments
Closed

TypeError: Cannot read property 'forEach' of undefined #44

ttly20 opened this issue Oct 16, 2018 · 2 comments

Comments

@ttly20
Copy link

ttly20 commented Oct 16, 2018

我在使用这个插件的时候遇到这个错误,已经好多天了,一直解决不了。
这是我的代码:
<script>
new Vue({
el: "#app",
components: {
vueWaterfallEasy
},
data() {
return {
imgsArr: [],
fechImgsArr: [],
group: 1,
}
},
methods: {
getData () {
axios.get("http://122.114.227.186:8080/" + this.group)
.then(res => {
this.imgsArr = res.data
this.group++
console.log(res.data)
})
},
},
created() {
this.getData()
}
})
</script>
这是我的后端返回的json:
image
这是chrome console下的结果:
image
可以看到res.data是有Array(0)属性的。
我查了很久的google,不管是用for in重组数组还是重写后端返回的json都解决不了这个问题,我很烦恼,各位大大能帮忙看一下吗?

@lfyfly
Copy link
Owner

lfyfly commented Oct 20, 2018

可以直接复制源码目录下的vue组件进行调试

@lfyfly lfyfly closed this as completed Oct 20, 2018
@benzun
Copy link

benzun commented Jul 29, 2019

我是用浏览器加载方式,使用也是报这个错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants