美文网首页
el-pagination 本地存储再更新当前页码

el-pagination 本地存储再更新当前页码

作者: 冬天的_太阳 | 来源:发表于2020-03-20 16:13 被阅读0次

通过定时器触发更新

  mounted() {
    // 更新当前页码
    let page = Number(localStorage.getItem("saPage")) || 1;
    this.$nextTick(function() {
      this.change(page);
    });
    console.log(this.currentPage2);
  },
  // 触发更新
    change(page) {
      // 模拟数据返回
      setTimeout(() => {
        this.currentPage2 = page; // 再次赋值
      }, 1000);
    }


        <el-pagination
              ref="pagination"
             
              background
              layout="prev, pager, next"
              :total="total"
              :current-page.sync="currentPage2"
              @current-change="changePage"
            ></el-pagination>


相关文章

网友评论

      本文标题:el-pagination 本地存储再更新当前页码

      本文链接:https://www.haomeiwen.com/subject/mrwjyhtx.html