分页、查询、重置、修改、删除
vue中的分页使用频繁,在此记录一下。因为分页一般和增删查改等一起使用,所以写了一套。若是没有使用到其他功能,可以直接删除,只使用分页功能。
pagination: {
total: 0,
current: 1,
pageSize: 10, //每页中显示10条数据
pageSizeOptions: ["10", "20", "30"], // 每页中显示的数据
showTotal: (total) => `共有${
total}条数据`, //分页中显示总的数据
showSizeChanger: true, // 显示页面条数改变
showQuickJumper: true, // 显示快速跳转
},
queryParam: {
//查询参数
page: 1, //第几页
size: 10, //每页中显示数据的条数
hosName: "",
hosCode: "",
province: "",
city: "",
},
// ---------- 分页函数 -------------
handleTableChange(pagination) {
this.pagination.current = pagination.current;
this.pagination.pageSize = pagination.pageSize;
this.queryParam.page = pagination.current;
this.queryParam.size = pagination.pageSize;
this.Search();
},
// 1. 获取列表函数,该函数的作用是获取页面上显示的表格
// 获取列表设置默认参数:分页为 1 的参数
getList(queryPath = "?pageNo=1") {
this.dataSource = []; // 重置 table 的 dataSource 数据
BZGLHttp