【发布时间】:2018-11-11 08:09:45
【问题描述】:
基本上我正在对一个从道具获取其值的数组进行排序,因为我们知道道具值不会改变(或者至少这是我在文档中读到的)但是当我对我的数组进行删除时,它也会影响道具:
props: ['allquestions','getskills'],
data() {
return {
getskillsnew: this.getskills,
searchwindow: true,
allquestionsnew: this.allquestions,
}
},
methods: {
filterop(value){
for (i = this.allquestionsnew.length - 1; i >= 0; --i) {
if (this.allquestionsnew[i].lastweek === 0) {
this.$delete(this.allquestionsnew, i);
}
setTimeout(() => {
this.searchwindow = true;
}, 1000)
}
}
}
所以在 for 循环完成后,我检查了我的道具(所有问题),它已被削减到 5,就像 this.allquestionsnew 一样,但我想要的是这个拼接只对 this.allquestionsnew 生效而不是道具!
我怎样才能做到这一点?谢谢
【问题讨论】:
标签: javascript vue.js vuejs2