<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的数据
Promise.all
方法async await
方法前端新手,vue.js刚接触。慢慢学习中。
有查到资料说用jsx来实现的,有时间再试试吧。