【发布时间】:2019-05-07 23:03:22
【问题描述】:
我尝试使用 Vue.js 进行迭代 结果出现这样的错误
[Vue 警告]:挂载钩子错误:“TypeError: this.frontImages.forEach 不是函数”
this.frontImages = {frontA:{name:'frontAName'},frontB:{name:'frontBName'}};
this.frontImages.forEach(function(value, index) {
console.log(value);
}
【问题讨论】:
-
.forEach()仅适用于数组。它不适用于 JSON 对象。 -
我们如何迭代这个对象
标签: javascript vue.js foreach iteration