el-table滚动加载
<div class="bottom"> <div class="title">优惠历史</div> <div style="overflow: auto; height: 220px"> <el-table v-el-table-infinite-scroll="load" border :data="historyData" class="customer-no-border-table" v-loading="historyLoading" element-loading-text="数据正在加载中..." :row-class-name="tableRowClassName" :header-cell-style="{ background: '#E7F2FD', color: '#252525', }" style=" width: 100%; border-top: 1px solid #409eff; margin-top: 0px; " height="220" > <el-table-column type="index" label="序号" width="50" align="center" header-align="center" ></el-table-column> <el-table-column v-for="(item, index) in historyColumns" :show-overflow-tooltip="item.prop == 'activityName'" :width="item.width" :key="index" :prop="item.prop" :label="item.label" :formatter="item.formatter" align="center" > </el-table-column> <el-table-column label="操作" width="150" align="center" header-align="center" > <template #default="{ row }"> <span v-for="(item, index) in listBtns2" :key="index" class="underline" @click="getDetail(item.resourceRemark, row)" > {{ item.resourceName }} </span> </template> </el-table-column> <div slot="empty"> <img src="@/assets/nodata.png" style="width: 150px; height: 105px" /> <div style=" font-size: 16px; color: #666666; height: 20px; line-height: 20px; " > 暂无数据 </div> </div> </el-table> </div> </div> </div>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // 请求优惠历史数据 getHistory() { this .historyLoading = true ; postToken(selectCompanyActivityHistory, { companyCode: this .trData.companyCode, buildId: this .buildRow.id, page: this .historyPage.page, }).then((res) => { if (res.data.status == 1) { let result = res.data; this .historyData = this .historyData.concat(result.rows); this .historyPage.total = result.total; console.log( this .historyData, result.rows, "优惠历史" ); } else { this .$message.error(res.data.msg); } this .historyLoading = false ; }); }, |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | load() { console.log( "表格scroll" , this .historyPage.page, this .historyPage.total); if ( this .historyPage.total > 0) { this .historyPage.page++; let totalPage = Math.ceil( this .historyPage.total / this .historyPage.size ); console.log( this .historyPage.page, totalPage, "表格滚动" ); if ( this .historyPage.page > totalPage) { return ; } else { this .getHistory(); } } }, |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现