vue加elementui开发的分页显示

时间:2021-08-01 15:11:37

由于我的是公共引入样式表和css表所以,将公共的也写出来了(我接手的项目为基于vue开发的)

公共的index.html

引入js

<script src="{MODULE_URL}static/js/modify.js" type="text/javascript" charset="utf-8"></script>
{MODULE_URL}static/在我的项目下都是这么写的,无论样式表还是css样式表
引入样式表
<link rel="stylesheet" type="text/css" href="{MODULE_URL}static/css/purchase.css?v=2019042001" />
 
vue的路由js配置页面的js路由(router.js)
,{
                path:"/PurchaseRecords",
                component:PurchaseRecords
   }
 新建一个js文件命名
const PurchaseRecords = {
    template: `
    <div class="demo">
        <div class="content" style="height:auto;">
            <div class="purchaserecords">
                <p>购买记录</p>
            </div>
            <div class="info">
                <input class="daochu"@click="" type="button" value="导出所有参与用户"/>
            <div class="title" style="margin-left: 24px;margin-top: 32px;">
                <div class="container_table">
                        <el-table :data="lists.slice((currentPage-1)*pagesize,currentPage*pagesize)" stripe style="width: 100%;border:none;" :default-sort="{prop: 'date', order: 'descending'}">
                                <el-table-column prop="userImg" label="用户头像"></el-table-column>
                                <el-table-column prop="lusername" label="昵称"></el-table-column>
                                <el-table-column prop="realname" label="真实姓名"></el-table-column>
                                <el-table-column prop="telnum" label="手机号"></el-table-column>
                                <el-table-column prop="conum" label="订单号"></el-table-column>
                                <el-table-column prop="hongb" sortable label="收到红包总金额"></el-table-column>
                                <el-table-column prop="bmtime" sortable label="报名时间"></el-table-column>
                                <el-table-column prop="downtime" sortable label="下单时间"></el-table-column>
                                <el-table-column label="操作">
                                    <template slot-scope="scope">
                                        <el-button type="danger" v-if="istag" @click=''>删除</el-button>
                                    <!-- <el-button type="primary" icon="el-icon-star-on" v-if="istag" @click='switchChange'></el-button>
                                        <el-button type="primary" icon="el-icon-star-off" v-else="!istag" @click='switchChange'></el-button>-->
                                    </template>
                                </el-table-column>
                            </el-table>
        <!--分页显示的数字-->
                        <el-pagination class="fy" layout="prev, pager, next,total" @current-change="current_change" :total=total></el-pagination>
                </div>
            </div>
        </div>
    </div>
</div>`,
    data() {
        return {
                total:1000,//默认数据总数
                pagesize:10,//每页的数据条数
                currentPage:1,//默认开始页面
                istag: true,
                input:"",
                input21: '',
                lists: [
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    },
                    {
                        "userImg": "img",
                        "lusername": "南柯残梦",
                        "realname": "流SIR",
                        "telnum": "18626131234",
                        "conum": "2019042112120304586",
                        "hongb": "22",
                        "bmtime": "2019-04-21 12:12:12",
                        "downtime": "2019-04-21 12:12:12"
                    }
                ]
                ,
                tableData:[]
            };
        } ,
                methods: {
                    tableRowClassName({row, rowIndex}) {
                        if (rowIndex === 0) {
                            return 'th';
                        }
                        return '';
                    },
                    switchChange(){
                        this.istag = !this.istag ;
                    },
                    created:function(){
                        this.total=this.lists.length;
                    },
                    current_change:function(currentPage){
                        this.currentPage = currentPage;
                    }
                }
}
vue加elementui开发的分页显示数据为写死的data
效果为上图
样式表
.el-table td, .el-table th.is-leaf{
border: none !important;
color:black;
}
.el-table--striped .el-table__body tr.el-table__row--striped td{
background-color:#fff;
}
.el-table th>.cell{
font-size:16px !important;
}
.el-table::before{
height: 0px !important;
}
.fy{
margin-top: 25px;
height: 58px;
text-align: center;
}
.el-pager li.active+li {
border-left:1px !important;
}
 
 

相关文章