一个页面,从一个文件夹引入了10张图片,怎么进行分页,让这十张图片分成五页.....实现跳转查看
element ui:
<div class="block">
<el-pagination
background
:current-page.sync="currentPage"
:page-sizes="[3, 6, 9, 12]"
:page-size="num"
layout="total, sizes, prev, pager, next, jumper"
:total="cardPhoto.length"
@size-change="handleSizeChange"
@current-change="handleCurrentChange">
</el-pagination>
</div>
data() {
return {
num: 3, //每页显示
currentPage: 1, //当前页
}
}
在v-for遍历图片时加入下行代码:
photo.slice((currentPage-1)num, currentPagenum)
<div>
<img v-for='p in imgs[pageIndex-1]' :src="p" alt="">
</div>
let imgs = {
0: ['1.png', '2.png',],
1: ['1.png', '2.png',],
2: ['1.png', '2.png',],
3: ['1.png', '2.png',],
4: ['1.png', '2.png',],
}