Vue 实现翻页器 下一页 处理显示多页面要下一页非表格

vue里面因为数据太多要弄多个页面,路由又不行,element ui的分页器用不了

我的环境是electron-vue,和vue通用的可以无视,这里采用了element ui 的走马灯当做容器翻页

首先把你的渲染数据的数组等分,我这里分成了一个数组8条数据
方法如下

let index = 0
      while (index< this.screenList.length) {
        this.newArr.push(this.screenList.slice(index, index += 8))
      }
      console.log('数组', this.newArr)

this.screenList是数据,newArr为等分后的数据
在这里插入图片描述
分好了,在dom进行循环渲染

  <el-carousel trigger="click" height="46vw" :autoplay="false" :loop="false" arrow="always">
      <el-carousel-item v-for="(item, idx) in newArr" :key="idx">
         <el-card class="box-card screen-list" 
                :style="{width: screenCaptureWidth+'px', height:screenCaptureHeight+60+'px'}" 
                :body-style="{padding: 0, overflow:'hidden'}" shadow="hover" v-for="item in newArr[idx]" :key="item.sourceId" :label="item.sourceName"
                :data="item.sourceId"
                >
                    <div   @click="onSelectScreenCapture(item.sourceId)">
                      <p :title="item.sourceName" class="screen-show"><canvas :id="['screen_'+item.sourceId]"></canvas></p>
                    <p class="screen-button">
                      <el-button style="width: 100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" type="text"> {{item.sourceName}} </el-button>
                    </p>
                    </div>
                </el-card>
      </el-carousel-item>
    </el-carousel>

效果如下
第一页
在这里插入图片描述
第二页,往后数据越多也能进行自动翻页
在这里插入图片描述

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值