vuex 刷新保存数据

created () {
      this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("beforeunload"))));
      window.addEventListener('beforeunload', ()=>{
        let state = JSON.stringify(this.$store.state)
          localStorage.setItem("beforeunload",state);
      });
    },
上一篇:JSON.stringify 语法实例讲解


下一篇:记录一些平时遇到的exception