vue中遍历数组中的一个对象中的值这种结构的数据怎么遍历出来?

function changeTree(val) {let arr = [];if (val.length !== 0) {val.forEach(item => {let obj = {};obj.id = item.path;obj.label = item.name;if (item.children.length >= 1) {obj.children = this.changeTree(item.children);}arr.push(obj);});}
return arr;
},
}
题目:{
{item.question}}
{
{item2}}
答案:{
{item.answer}}
赋值代码:getData() {
console.log("试卷编号是:id==" + localStorage.getItem("examId"));this.$axios.get("/exam/findExamById", {params: {id: localStorage.getItem("examId")}}).then(response => {
console.log(response.data.result);if (response.data.result) {
// this.ruleForm = response.data.result;console.log(typeof this.ruleForm);var
}
1.思路:三组数据为一组那么我们可以把三组数据放到一个集合里面。遍历的时候双层for循环 效果图如下:码字不易,如果对您有帮助请点个小心心!}

我要回帖

更多关于 vue中遍历数组中的一个对象中的值 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信