master
e 8 months ago
parent a82dc8d046
commit d752393a58

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

@ -35,17 +35,42 @@ export const tableListMixins = {
},
mounted() {},
methods: {
//数据加载
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({
id: i + "",
name: "测试" + i,
id: params.pageNo + "_" + 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"
>
<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>
</gMainTable>
</div>

Loading…
Cancel
Save