.map 给数组对象添加新属性

let menuList = [
{name:'晓明',age:18},
{name:'黎明',age:20},
{name:'德华',age:28},
]
const list = this.list.map((item) => ({
    ...item,
    title: `新属性1`,
    productName: '新属性2',
    income: '新属性3'
}))

// 

 

posted @ 2022-09-22 20:59  james_liang  阅读(187)  评论(0编辑  收藏  举报