vue給請求接口數據增加一行新數據


一、添加數據前

二、添加數據后

三、實現方法

setPayWaySummaryList() {
    // summaryArr格式和接口的要一樣,summaryArr為添加到data的第三條數據
const summaryArr = { cash: 0, pos: 0, wechat: 0, cb: 0, bc: 0, name: '合計', }; const arrLength = this.statisticalQuery.length;// 查詢接口數據數組長度 for (let i = 0; i < arrLength; i++) { summaryArr.cash += this.statisticalQuery[i].cash || 0; summaryArr.pos += this.statisticalQuery[i].pos || 0; summaryArr.wechat += this.statisticalQuery[i].wechat || 0; summaryArr.cb += this.statisticalQuery[i].cb || 0; summaryArr.bc += this.statisticalQuery[i].bc || 0; } this.statisticalQuery.push(summaryArr); },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM