data() { return { names: [ {id: 1, name:'张三', age: 20 }, {id: 2, name:'李四', age: 8 }, {id: 3, name: 'Zhang San', age: 18} ] } }, methods: { fun2() { return this.names.map((item) => { temp = JSON.parse(JSON.stringify(item))//To prevent If an error occurs, use a deep copy temp.age = item.age + 1 return temp })
In order to prevent errors, deep copy is used
Guess you like
Origin blog.csdn.net/qq_45424679/article/details/115299667
Recommended
Ranking