原文链接:https://blog.csdn.net/StephenO_o/article/details/84234916
<div class="pagePagination">
<el-pagination
@current-change="handleCurrentChange"
:page-size="listPageEvery"
layout="prev, pager, next"
prev-text="<上一页"
next-text="下一页>"
:total="listAllNum"
background
:current-page.sync="listCurrentPage"
v-if="listAllNum != 0"
></el-pagination>
</div>
js分页
// 页码跳跃
handleCurrentChange(currentPage) {
this.getList(currentPage);
this.listCurrentPage = currentPage;
this.setContextData("listCurrentPage", this.listCurrentPage);
},
//给sessionStorage存值
setContextData: function (key, value) {
if (typeof value == "string") {
sessionStorage.setItem(key, value);
} else {
sessionStorage.setItem(key, JSON.stringify(value));
}
},
// 从sessionStorage取值
getContextData: function (key) {
const str = sessionStorage.getItem(key);
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
return str;
}
}
return;
},