undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at _iterableToArray
undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at _iterableToArray
·
undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at _iterableToArray
如果报了这个错误,说明你代码中可能用了 es6中的拓展运算符
我的是这样用的
async loadMore() {
// 获取朋友圈动态
let response = await this.$api.myCollect()
this.arr= [...this.arr, ...response.data.Arr];
}
解决方法是: 做个判断
async loadMore() {
// 获取朋友圈动态
let response = await this.$api.myCollect()
if (response.code == 200 && response.data.Arr) {
this.arr= [...this.arr, ...response.data.Arr];
}
}
原因是 :
... 这三个点,不能作用在undefined的数据上,所以做个判断就可以了
更多推荐
已为社区贡献2条内容
所有评论(0)