当我应用拼接来删除数据中的元素时,我具有父级和子级组件,计数正确但在视图(html)中没有反应
帮助我 这是我的父组件
data(){
return {
unit: this.unit_prop,
weeks: this.unit_prop.weeks,
error_in_form:false
}
},
methods:{
addWeek(){
const unique_key= new GenerateKey(this.weeks.length).unique_key;
const number_week = this.weeks.length+1;
this.weeks.push( new WeekDTO(unique_key, number_week) );
},
removeWeek(index){
this.weeks.splice(index,1);
const elob = this.weeks[index];
console.log(elob);
elob.number_week=44;
console.log(elob.number_week);
//this.$emit('watch','WeekSilabus');
this.$set(this.weeks[index],'number_week', 40);
}
},
watch:{
weeks: (arr_weeks)=>{
arr_weeks.forEach((element,index) => {
//element.number_week = index+1;
});
}
}
}
当我删除一个星期后,此更改将应用到数据中,但不会刷新到组件视图