美文网首页
vue实现分页功能

vue实现分页功能

作者: Henry01 | 来源:发表于2021-04-01 10:11 被阅读0次

1,HTML代码


<template>
       <el-pagination style="float:right;margin-top: 0"
                                           @size-change="handleSizeChange"
                                           @current-change="handleCurrentChange"
                                           :page-size="rows"
                                           :current-page.sync="currentPage"
                                           layout="total, prev, pager, next, jumper"
                                           :total="disasterCount"></el-pagination>
</template>

2,script代码


<script>

export default {

name:'EarthComp',

    data() {
        return {
                pageSize: 1,
                rows: 10,
                currentPage: 1,
                disasterCount:'',
        }
},

methods: {

            //数据请求
            getdiseaseTypeFn(){
                getdiseaseType({page:this.currentPagea,rows:this.rowsa}).then(res => {
                    this.getdiseaseTypeTable = res.data;
                    this.disasterCounta = res.count;
                });
            },        

          //分页点击
           handleSizeChange (val) {
                this.rows = val;
            },
            handleCurrentChange (val) {
                this.currentPage = val;
                this.getdeviceTypeFn();
            },
}

</script>

效果预览


image.png

相关文章

网友评论

      本文标题:vue实现分页功能

      本文链接:https://www.haomeiwen.com/subject/rxfahltx.html