uniapp实现分页功能

本文介绍了如何在uni-app中实现分页功能,通过使用uni-load-more组件,展示了分页加载的效果,并提供了相关组件的路径。
摘要由CSDN通过智能技术生成

uniapp实现分页功能

效果图

在这里插入图片描述

 <!-- 列表数据 -->
    <view class="homecenter">
      <template v-if="progitlist && progitlist.length > 0">
        <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="toLowerLoad">
          <view class="conlists" v-for="(item, index) in progitlist" :key="index">
            <view class="content" style="width: 340rpx">{
   {
    item.payTime }}</view>
            <view class="content">{
   {
    item.classificationName || '-' }}</view>
            <view class="content">{
   {
    item.money }}</view>
          </view>
          //这是组件 内容在下边放着
          <uni-load-more :status="status"></uni-load-more>
        </scroll-view>
      </template>
      <view class="noResult" v-else>
        <image class="noImg" src="/static/imgs/noResult2.png">
        <template>
            <view class="line1">暂无内容</view>
         </template>
      </view>
    </view>

  data(){
   
    return{
   
       page: 1,
       row: 10,
       total: 0, 
       classificationId:'',
       progitlist: [],
       status: 'empty', // more-加载前;loading-加载中;noMore-没有更多了;empty-空数据
   }
 },
  onLoad(option) {
   
    this.getlist(1);
  },
 methods:{
   
  async getlist(page) {
   
  
      let data = {
   
      
        page: page,
        
        row: 10,
        
        classificationId: this.classificationId,
        
      };
      
      this.status = 'loading';
      
      let res = await appService.AgencyRevenue(data);
      
      if (res.code == 200) {
   
       
        this.page = page
        
        this.total = res.data.data.myFinanceIPage.total * 1//因为我这返回的total是字符串1所以最后乘以1
        
        
        if(page == 1){
   
        
          this.progitlist = res.data.data.myFinanceIPage.records;
          
        }else{
   
        
          this.progitlist = this.progitlist.concat(res.data.data.myFinanceIPage.records)
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值