If you need an example, I've prepared a simple one for you. In this instance, all data is already on the front-end. However, in a real-world application, you would likely make a call to a back-end service. So, if you want to implement features like sorting, you would need to handle that in the back-end service.
Best of luck with your project.
For the HTML:
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b2e272e262e253f663e220b79657a78657b">[email protected]</a>/lib/index.js"></script>
<div id="app">
<template>
<el-table :data="pagedTableData" style="width: 100%">
<el-table-column prop="date" label="Date" width="180"></el-table-column>
<el-table-column prop="name" label="Name" width="180"></el-table-column>
<el-table-column prop="address" label="Address"></el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :total="this.tableData.length" @current-change="setPage">
</el-pagination>
</template>
</div>
For the JavaScript:
var Main = {
created() {
for (let i = 0; i < 100; i++) {
this.tableData.push({ date: '2016-05-03', name: 'Tom', address: `No. ${i}, Grove St, Los Angeles`
})
}
},
data() {
return {
tableData: [],
page: 1,
pageSize: 10
}
},
computed: {
pagedTableData() {
return this.tableData.slice(this.pageSize * this.page - this.pageSize, this.pageSize * this.page)
}
},
methods : {
setPage (val) {
this.page = val
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
You can also find this example on Codepen