master
e 8 months ago
parent a82dc8d046
commit d752393a58

@ -1,6 +1,6 @@
<template> <template>
<div class="gMainTable"> <div class="gMainTable">
<el-table ref="gMainTable" :data="tableData"> <el-table ref="gMainTable" size="small" :data="tableData">
<template v-for="(item, index) in columns"> <template v-for="(item, index) in columns">
<el-table-column <el-table-column
v-if="item.slot" v-if="item.slot"
@ -56,11 +56,13 @@ export default {
}, },
methods: { methods: {
// //
pageSizeChange() { pageSizeChange(item) {
this.$emit("") this.$emit("pageSizeChange", item);
}, },
// //
currentPageChange() {}, currentPageChange(item) {
this.$emit("currentPageChange", item);
},
}, },
}; };
</script> </script>

@ -35,17 +35,42 @@ export const tableListMixins = {
}, },
mounted() {}, mounted() {},
methods: { methods: {
//数据加载
loadData() { loadData() {
for (let i = 0; i < 10; i++) { this.dataSource = [];
let params = this.getQueryParams();
//模拟接口返回数据总数total
let total = 60;
this.ipagination.total = total;
//console.log(params);
for (let i = 0; i < params.pageSize; i++) {
this.dataSource.push({ this.dataSource.push({
id: i + "", id: params.pageNo + "_" + i,
name: "测试" + i, name: "当前页:" + params.pageNo,
}); });
} }
//console.log(this.dataSource);
},
//处理查询参数
getQueryParams() {
let param = {};
param.pageNo = this.ipagination.currentPage; //当前页码
param.pageSize = this.ipagination.pageSize; //每页条数
return param;
}, },
//每页条数发生改变 //每页条数发生改变
handlePageSizeChange() {}, handlePageSizeChange(item) {
this.ipagination.pageSize = item;
this.ipagination.currentPage = 1;
this.loadData();
},
//当前页码发生改变 //当前页码发生改变
handleCurrentPageChange() {}, handleCurrentPageChange(item) {
this.ipagination.currentPage = item;
this.loadData();
},
}, },
}; };

@ -13,7 +13,7 @@
@currentPageChange="handleCurrentPageChange" @currentPageChange="handleCurrentPageChange"
> >
<template v-slot:vaeSlot="{ scope }"> <template v-slot:vaeSlot="{ scope }">
<el-button type="primary">{{ scope.row.name }}</el-button> <el-button size="small" type="primary">{{ scope.row.name }}</el-button>
</template> </template>
</gMainTable> </gMainTable>
</div> </div>

Loading…
Cancel
Save