Element Paging Component Usage and Time Conversion
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[5,10,20]" :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
data() { return { list: [], Total: 0,//Total records CurrentPage: 1,//The current page PageSize: 10,//The size of each page SearchMap: {},//Query conditions DialogFormVisible: false,//Whether the editing window is visible Pojo: {},//Edit the entity object bound by the form Id: ''//The ID modified by the current user } }
fetchData() { userApi.search(this.currentPage, this.pageSize, this.searchMap).then(response => { this.list = response.data.rows this.total = response.data.total }) }, handleSizeChange(val) { //Automatically triggered when the number of displayed items per page is changed this.pageSize = val; // Dynamically change the size of each page userApi.search(this.currentPage, val, this.searchMap).then(response => { this.list = response.data.rows this.total = response.data.total }) }, handleCurrentChange(val) { //Trigger this function after the current page number changes this.currentPage = val; // Dynamically change the current page userApi.search(val, this.pageSize, this.searchMap).then(response => { this.list = response.data.rows this.total = response.data.total }) }
timestampToTime (row, column) { Var date=new Date (row. regdate)//A time stamp of 10 bits requires * 1000, and a time stamp of 13 bits does not need to multiply by 1000 var Y = date.getFullYear() + '-' var M = (date.getMonth()+1 < 10 ? ' 0'+(date.getMonth()+1) : date.getMonth()+1) + '-' var D = date.getDate() + ' ' var h = date.getHours() + ':' var m = date.getMinutes() + ':' var s = date.getSeconds() return Y+M+D+h+m+s }
<el table column prop="regdate" label="Registration date": format="timestampToTime"></el table column> <el table column prop="updatedate" label="modification date": format="timestampToTime"></el table column>