data(){
return:{
productList:[{id:1,name:'张三'}]
}
}
goodsFormart() {
let productList = this.productList
productList.map((item, index) => {
if (item.endTime) {
let endTime = item.endTime
let timeJson = this.timeFormart(endTime)
item.timeJson = timeJson
this.productList.splice(index, 1, item)
}
})
}
注解: splice(index, 1, item) ,删除当前下标的一个长度,并且替换掉,改变原数组内容,这时候data里面就行监听到变化了.