前后端开发分页操作

2019-04-17  本文已影响0人  寂川_b645

基于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>

上一篇 下一篇

猜你喜欢

热点阅读