由于javascript的限制Vue不能检测到以下变动的数组如objArr1.通过索引直接设置数组的某个值this.objArr[index] newValue;2.通过索引直接设置数组中对象的某个属性this.objArr[index].pro newValue;3.通过修改数组的长度this.objArr.length newLength;解决办法1.索引直接设置数组的某个值//1.Vue.set Vue.set(this.objArr,index,newValue); //(数组索引值) this.$set(this.objArr,index,newValue); //2.prototype.splice this.objArr.splice(index,1,newValue) //(索引长度值) //3.Object.assign this.objArr[index] newValue this.objArr Object.assign({},this.objArr) //存在弊端该objArr的类型会从数组变成对象2.索引直接设置数组中对象的某个属性//1.Vue.set this.objArr[index].pro newValue var tempObj this.objArr[index] Vue.set(this.objArr,index,tempObj) //(数组索引值) this.$set(this.objArr,index,newValue); //2.prototype.splice this.objArr[index].pro newValue var tempObj this.objArr[index] this.objArr.splice(index,1,tempObj) //(索引长度值) //3.Object.assign this.objArr[index].pro newValue this.objArr Object.assign({},this.objArr) //存在弊端该objArr的类型会从数组变成对象3.修改数组的长度//1.prototype.splice this.objArr.splice(this.objArr.length,0,new Object()) //(索引长度值) 从长度索引开始增加一个新的对象。 0 表示不删除 //2.Object.assign this.objArr.length newLength this.objArr Object.assign({},this.objArr) //存在弊端该objArr的类型会从数组变成对象