<div class="block">
<el-pagination
layout="prev, pager, next"
:page-size="pagesize"
@current-change="current_change"
:current-page.sync="currentPage"
:total=info.length>
</el-pagination>
<script>
export default {
data(){
return{
info:[],//数据
pagesize:5,//每页多少数据
currentPage:1 //默认当前页为第一页
}
},
methods:{
current_change(currentPage){ //改变当前页
this.currentPage = currentPage
}
},
mounted(){ //如果使用数据接口
axios.get('/api',{
params:{
//请求参数
}
}).then(res => {
this.info = res.data //赋值
})
}
}
</script>