您当前的位置: 首页 > 

暂无认证

  • 0浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

vue+element中的 InfiniteScroll 无限滚动 实现分页请求数据

发布时间:2021-09-18 14:36:49 ,浏览量:0

目录
    • 1、html部分
    • 2、css部分
    • 3、JavaScript部分
1、html部分
<div class="Record-frame" v-infinite-scroll="infiniteScroll" :infinite-scroll-disabled="isInfiniteScroll" :infinite-scroll-distance="5" > <div v-for="item in dataList" :key="item.id"> <div>{{ item.name }} height: 470px; overflow-y: scroll; } 
3、JavaScript部分
export default { name: "LinkageRecord", data() { return { dataList: [], total: 0, query: { pageNum: 1, pageSize: 10, }, isInfiniteScroll: false, // 控制滚动禁用 }; }, methods: { // 滚动条触底 infiniteScroll() { this.isInfiniteScroll = true; this.getLinkRecordV1ListS(); }, // 获取数据 getData() { getAxios(this.query).then((response) => { let { total, records } = response; this.dataList = [...this.dataList, ...records]; this.total = total; this.query.pageNum += 1; if (records.length < this.query.pageSize || this.dataList.length == this.total) { this.isInfiniteScroll = true; return false; } this.isInfiniteScroll = false; }); } } }; 

原文链接

关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.3489s