Basically I'm doing some sorting on an array which gets its value from a prop, as we know props values wont get changed (or at least that's what I read in docs) but when I do a remove on my array, it effects the prop as well:
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)
}
}
}
so after the for-loop is done and I check my prop (all questions) it has been cut down to 5 as like as this.allquestionsnew
, but i want is that this splice only takes effect on this.allquestionsnew
not on the prop!
how can i achieve this? Thanks