vue page refresh the page data is not the problem

vue page refresh the page data is not the problem

vue page jump parameter parmas carried in a refreshing new pages will be lost,
1. sessionStorage save the page to use to refresh the data whenever the page how data will be lost
page setup pass parameters


    xiang(row) {
      this.id = row;
      //把页面要传的参数存到sessionStorage里面
      sessionStorage.setItem("id", this.id);
      //   console.log(row); //此时就能拿到整行的信息
      this.$router.push({
        name: "newsdetail",
        params: {
          id: this.id
        }
      });
    },

Take out the newly opened pages

created() {
    // this.id = this.$route.params.id;
    //从sessionStorage把页面要用的参数取出来
    this.id = sessionStorage.getItem("id");
    // sessionStorage.clear("id");
    //页面加载要用到的方法
    this.pagination();
  },

Guess you like

Origin blog.csdn.net/qq_41241767/article/details/90644421