getData() {
return new Promise((resovle, reject) => {
console.log('reject', reject);
this.loading = true;
this.tableLoading = true;
testCnode().then(res => {
if (res.data.success) {
resovle(res);
}
});
});
},
onSearch() {
this.getData().then(res => {
if (res.data.success) {
let tableData = res.data.data;
tableData.forEach((ele, index) => {
ele.key = tableData[index].id;
});
this.data = tableData;
this.loading = false;
this.tableLoading = false;
message.success('请求成功');
}
});
},
<a-button type='primary' icon='search' on-click={this.onSearch} loading={this.loading}>
搜索
</a-button>
<div style='height:500px'>
<a-table
bordered
scroll={
{
y: 400 }}
columns={this.columns}
loading={this.tableLoading}
data-source={this.data}
row-selection={
{
selectedRowKeys: this.selectedRowKeys, onChange: this.onChange }}
scopedSlots={this.scopedSlots()}
></a-table>
</div>