场景:从子组件中把列表数据显示到表格,表格中的数据input不可编辑。
javascript
showCouponSelect(couponSelect) {
this.benefit.couponSelect = JSON.parse(JSON.stringify(couponSelect))
console.log('-----showCouponSelect-------')
console.log(this.benefit.couponSelect)
this.selectedCount = couponSelect.length
},
把this.benefit.couponSelect = couponSelect 改成
this.benefit.couponSelect = JSON.parse(JSON.stringify(couponSelect)).前端大佬说 element 监测不到数据的变动,需要深拷贝对象。