elementui的分页中的页面查看详情后返回当前页

列表页

methods() {
	//改变页数
	currentChange(val) {
	  this.page.currentPage = val;
	  //缓存当前页码数
	  sessionStorage.setItem('currentPage',val);
	  //调取表格列表接口
	  this.getList(this.page)
	},
	getSchoolWebModuleMessageListFunc(){ //当从详情页返回的时候,先获取详情页中存下来的detall标识,在列表页中,把获取到的分页页码重新赋值,用以返回前的页面,保持不变
	  if(sessionStorage.getItem('detail')){
	    //如果有这个就读取缓存里面的数据
	   this.page.currentPage=Number(sessionStorage.getItem("currentPage"));
	  }else{
	    this.page.currentPage=1;
	    //这个主要是从其他页面第一次进入列表页,清掉缓存里面的数据
	    sessionStorage.removeItem("currentPage");
	  }
	},
}

然后在mounted中执行这个方法

mounted() {
	   this.getSchoolWebModuleMessageListFunc();
}

再在destroyed中销毁缓存

destroyed(){
	  sessionStorage.removeItem("detail");
},

详情页

mounted() {
	  //如果从详情页返回,从缓存中读取当前页码信息。此时缓存是否打开了详情页
	  sessionStorage.setItem("detail",true);
}
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值