错误代码:
let upTemp = this.billlist[a];
let downTemp =this.billlist[a];
upTemp.money = upTemp.money-je;
downTemp.money = je;
此时upTemp、downTemp、this.billlist[a]中的money是相同的。
修改:
let upTemp = JSON.parse(JSON.stringify(this.billlist[a]));
let downTemp = JSON.parse(JSON.stringify(this.billlist[a]));
补充:
拼接两个数组:
this.list = this.list.concat(list2);//将list与list2拼接在一起
将table中的一条数据带入form中,值无法改变:
<el-table-column label="操作" align="center">
<template scope="scope">
<el-button type="text" size="small" icon="el-icon-edit" title="修改" @click="editLogStatus(scope.$index, scope.row)"/>
</template>
</el-table-column>
错误赋值:
editLogStatus(index, row){
this.logStatusVisible = true;
this.form.logStatus = row.logStatus;
// this.form.logStatus = JSON.parse(JSON.stringify(row.logStatus));
},
正确赋值:
editLogStatus(index, row){
this.logStatusVisible = true;
this.form = Object.assign({}, row);
},