vue实现前进刷新后退不刷新,比如列表页进入详情页,详情页刷新,但是退回列表页,不刷新依旧是当前页码。
列表页:
mounted() {
this.getPageIndex(); }, methods: { getPageIndex() { if (sessionStorage.getItem('message_management_detail')) {
this.page = sessionStorage.getItem("message_management_currentPage") ? Number(sessionStorage.getItem("message_management_currentPage")) : 1;
} else {
this.page = 1;
sessionStorage.removeItem("message_management_currentPage");
}
}
setCurrent(val) {
this.page = val;
sessionStorage.setItem('message_management_currentPage', val);
this.getDataList();
}
},
详情页:
mounted() {
sessionStorage.setItem("message_management_detail", true);
},