前后端开发分页操作

基于spring boot+vue的分页实现

1.在pom.xml中添加依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>

  1. 在application.properties中添加配置

pagehelper.helperDialect=mysql
pagehelper.reasonable=false
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql

  1. 在Controller层中使用
    @GetMapping(value = "/*")
    public ResponseResult getAll(@RequestParam(defaultValue = "1") int pageNo, @RequestParam(defaultValue = "10") int pageSize) {
    PageHelper.startPage(pageNo,pageSize);
    //pageNo是页数,默认为1;pageSize是数量,默认为10
    //方法自写
    return ;
    }

前端

  1. 使用hello uni-app组件uni-load-more.vue

<template>
<uni-load-more :loadingType="loadingType" :contentText="contentText"></uni-load-more>
</template>
<script>
import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue"
export default {
components: {uniLoadMore}
}
</script>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容