数组push时,第二次的数据会覆盖第一次的数据
let currentData = {
oneMonth: this.oneMonth,
twoMonth: this.twoMonth,
threeMonth: this.threeMonth,
fourMonth: this.fourMonth,
fiveMonth: this.fiveMonth,
sixMonth: this.sixMonth,
sevenMonth: this.sevenMonth,
eightMonth: this.eightMonth,
nineMonth: this.nineMonth,
tenMonth: this.tenMonth,
elevenMonth: this.elevenMonth,
twelveMonth: this.twelveMonth
}
错误写法
this.list.push( { value: currentData } )
正确写法
this.list.push( { value: JSON.parse(JSON.stringify(currentData )) } )