1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| created() { window.addEventListener("beforeunload", () => { sessionStorage.setItem("list", JSON.stringify(this.$store.state)); }); try { sessionStorage.getItem("list") && this.$store.replaceState( Object.assign( {}, this.$store.state, JSON.parse(sessionStorage.getItem("list")) ) ); } catch (err) { console.log(err); } sessionStorage.removeItem("list"); },
|