You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

42 lines
1.2 KiB

<template>
<div style="width: 100%;height: 100%">
<el-table :data="tableData" style="width: 100%; margin-top: 5px">
<el-table-column v-for="(value,key) in tableData[0]" :prop="key" :label="key"></el-table-column>
</el-table>
<div style="width: 100%; height: 32px">
<el-pagination
style="position: absolute;right: 0"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, prev, pager, next"
:total="data.length">
</el-pagination>
</div>
</div>
</template>
<script setup>
import {computed, ref} from "vue";
const props = defineProps({
data: Array
})
const currentPage = ref(1)
const pageSize = ref(10)
function handleCurrentChange(page) {
currentPage.value = page;
}
function handleSizeChange(size) {
pageSize.value = size;
}
const tableData = computed(() =>{
const start = (currentPage.value - 1) * pageSize.value;
const end = start + pageSize.value;
return props.data.slice(start, end);
})
</script>
<style scoped lang="scss">
</style>