Vue+element纯前端封装分页表格
·
📦 前端资源合集 | 持续更新
🟢 前端0到1【持续更新】→ https://pan.quark.cn/s/5df55ccff7c4
🔵 前端进阶【持续更新】→ https://pan.quark.cn/s/2dec1c87b3ec
🟣 前端2026最新【持续更新】→ https://pan.quark.cn/s/77c8fa94161c
🔴 AI最新学习资料 → https://pan.baidu.com/s/1P9X2Qk_Fby3rFNVGw_WKow?pwd=46XG 提取码:46XG
<template>
<!-- 纯前端分页表格,只需传tableData -->
<el-row>
<el-col>
<el-table
:data="
tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)
"
style="width: 100%; padding: 0 100px"
>
<!-- 插槽放表格列 -->
<slot />
</el-table>
</el-col>
<el-col>
<el-pagination
background
style="text-align: right"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.length"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-col>
</el-row>
</template>
<script>
export default {
props: {
tableData: {
type: Array,
default: () => []
}
},
data() {
return {
pageSize: 10,
currentPage: 1
}
},
methods: {
handleSizeChange(size) {
this.pageSize = size
},
handleCurrentChange(current) {
this.currentPage = current
}
}
}
</script>
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)