往后台传参:
export function findDataInfoByPage(pageNum, pageSize) {
return request({
url: "/data_manage/findDataInfoByPage",
method: "post",
data: {
pageNum: pageNum,
pageSize: pageSize
},
baseURL: ip1, // 直接通过覆盖的方式
headers: {
"Content-Type": "application/json;charset=UTF-8"
}
});
}
前台请求结果:
<template>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
highlight-current-row
></el-table>
<pagination
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="fetchData"
/>
</template>
<script>
import Pagination from '@/components/Pagination'
export default {
components: { Pagination },
data() {
return {
list: null,
listLoading: true,
total: 0,
listQuery: {
page: 1,
limit: 20
}
}
},
methods: {
fetchData() {
findDataInfoByPage(this.listQuery.page, this.listQuery.limit).then(
response => {
debugger;
this.list = response.data[0];
this.listLoading = false;
this.total = Number(response.total);
}
);
},
}
}
</script>