- // 一般在查询参数中定义分页变量
- queryParams: {
- pageNum: 1,
- pageSize: 10
- },
-
- // 页面添加分页组件,传入分页变量
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
-
- // 调用后台方法,传入参数 获取结果
- listUser(this.queryParams).then(response => {
- this.userList = response.rows;
- this.total = response.total;
- }
- );
- @PostMapping("/list")
- @ResponseBody
- public TableDataInfo list(User user)
- {
- startPage(); // 此方法配合前端完成自动分页
- List<User> list = userService.selectUserList(user);
- return getDataTable(list);
- }