zoukankan      html  css  js  c++  java
  • vue 分页跳转页面详情,返回记住当前点击第几页

    列表页

    mounted 调用:

    mounted() {
        this.getSchoolWebModuleMessageListFunc();
      },

    methods中,定义:

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

    在分页的 handleCurrentChange 中,点击切换分页页码,获取当前点击的是第几页:

    handleCurrentChange(val) {
          // console.log(val);
          this.pageNo = val;
          sessionStorage.setItem('currentPage',val);
        }
    

      离开页面时候,清除:

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

    详情页:

    初始化数据的时候,设置标识: sessionStorage.setItem("detail",true);

  • 相关阅读:
    gradle
    1-NIO使用
    处理非正常终止的错误
    一个取消多生产者单消费者的日志线程池服务
    executes()源码
    死锁
    CyclicBarrier使用
    Semaphore
    Spring学习(4)IOC容器配置bean:定义与实例化
    在Maven上Web项目添加Spring框架
  • 原文地址:https://www.cnblogs.com/moguzi12345/p/12851245.html
Copyright © 2011-2022 走看看