zoukankan      html  css  js  c++  java
  • vue-cli3 element 分页组件el-pagination的基本使用

    <!--分页组件-->
                <el-pagination
                    :total="total"
                    :current-page="currentPage"
                    :page-size="pageSize"
                    :page-sizes="[10, 20, 30, 50]"
                    :pager-count="5"
                    @current-change="handleCurrentChange"
                    @size-change="handleSizeChange"
                    background
                    layout="total, sizes, prev, pager, next">
                </el-pagination>
    <script>
    export default {
        data(){
            return {
                total: 0,
                currentPage: 1,
                pageSize:10,
                loading: false,
                searUser: {},
                tableData:[]
            }
        },
        methods:{
            select_user(){
                this.loading = true;
    
                this.searUser.currentPage = this.currentPage; 
                this.searUser.pageSize = this.pageSize;
    
                this.$axios.get('/api/users/search',{params:this.searUser})
                    .then(res => {
                        this.loading = false;
    
                        window.console.log(JSON.stringify(res));
    
                        this.tableData = res.data.records;
    
                        this.total = res.data.total;
    
                    }).catch(err => {
                        this.loading = false;
                        this.$message.error(err);
                    });
            },
    
            handleCurrentChange(val){
                this.currentPage = val;
    
                this.select_user();
            },
    
            handleSizeChange(val){
                this.pageSize = val;
            }
        }
    }
    </script>

    效果:

  • 相关阅读:
    flask项目部署
    FastDFS分布式文件系统
    《app》团队冲刺二
    《APP》团队开发一
    软工二年级团队项目----自律小助手
    团队项目新闻app的需求分析
    团队成员及团队项目
    团队冲刺第八天
    团队冲刺第七天
    团队冲刺第六天
  • 原文地址:https://www.cnblogs.com/yshyee/p/10878180.html
Copyright © 2011-2022 走看看