记录下。。。持续更新
1、反向显示index
v-for="(item, index) in this.showTreeData"
{{ showTreeData.length - index }}
2、随机数赋值
item.score = 5 + parseInt(5 * Math.random())
3、从Json数组中提取所需值,组成新的Json数组
this.level2.map((item) => {
if (
(item.score > 1 || item.score == 1) &&
(item.score < 3 || item.score == 3)
) {
this.jiaocha.push({
name: item.name,
score: item.score,
});
} else if (
(item.score > 3 || item.score == 4) &&
(item.score < 7 || item.score == 7)
) {
this.chabuduo.push({
name: item.name,
score: item.score,
});
} else if (
(item.score > 7 || item.score == 8) &&
(item.score < 10 || item.score == 10)
) {
this.good.push({
name: item.name,
score: item.score,
});
}
});