js数组中对象追加字段

-- for循环追加字段
for (const i in this.tableData) {
        this.tableData[i].$cellEdit = true
}
 
--map
let arr = []
this.tableData.map((item) => {
      arr.push(Object.assign({},item,{$cellEdit:true}))
})
this.tableData = arr
posted @ 2021-07-06 15:39  Smile浅笑  阅读(1734)  评论(0编辑  收藏  举报