feat: 对除dashboard外的列表每页记录数进行缓存记录

This commit is contained in:
陈劲松
2020-03-13 12:20:02 +08:00
parent 0cad2d7f35
commit e0826b7cde
12 changed files with 88 additions and 13 deletions

View File

@@ -69,7 +69,7 @@
:data="tableData"
border
v-scrollBar:el-table
height="calc(100% - 125px)"
:height="$tableHeight.normal"
ref="dcTable"
style="width: 100%;">
<el-table-column
@@ -128,7 +128,7 @@
</template>
</el-table-column>
</el-table>
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
<button class="to-top" v-show="showTopBtn1" @click="toTop"><i class="nz-icon nz-icon-top"></i></button>
<!--dc table end-->
<element-set
@@ -232,6 +232,7 @@
},
data() {
return {
tableId: 'dcTable', //需要分页的table的id用于记录每页数量
showTopBtn1: false,
showTopBtn2: false,
currentDc: {
@@ -492,6 +493,7 @@
this.getTableData();
},
pageSize(val) {
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val);
this.pageObj.pageSize = val;
this.getTableData();
},
@@ -563,6 +565,12 @@
}
},
mounted() {
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize) {
this.pageObj.pageSize = pageSize
}
this.getTableData();
this.$nextTick(function(){
this.getUserData();//绑定滚动条事件控制top按钮