一、添加数据前

vue给请求接口数据增加一行新数据

二、添加数据后

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); },

 

相关文章:

  • 2022-02-04
  • 2021-12-18
  • 1970-01-01
  • 2022-12-23
  • 2021-07-09
  • 2021-07-16
  • 2021-12-29
  • 2021-10-08
猜你喜欢
  • 2022-12-23
  • 2021-12-22
  • 2021-11-26
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案