两个请求不同返回属性,放在一个el-table中


<el-table
      :data="tableData"
      border
      style="width: 100%">
      <el-table-column
        prop="SF"
        label="SF"
        width="180">
      </el-table-column>
      <el-table-column
        prop="username"
        label="姓名">
      </el-table-column>

    </el-table>
//这个查询来的是 SF

  this.$axios.post('http://localhost:8899/api/chaXun1', {
        tableName: this.shuJu
      }, {headers: {'Content-Type': "application/json"}}).then(res => {
        this.tableData = res.data
      }).catch(err => {
        console.log('操作失败' + err)
      })


//这个查出来的是username
  this.$axios.post('http://localhost:8899/api/chaXun2', {
        tableName: this.shuJu
      }, {headers: {'Content-Type': "application/json"}}).then(resp => {
        this.tableData = resp.data
      }).catch(err => {
        console.log('操作失败' + err)
      })

请求完成两个请求以后,自己组织table的数据

  1. Promise.all 方法
  2. async await 方法