You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
624 B

  1. export default function(ctx){
  2. //离开页面 刷新前 将store中的数据存到session 刷新找不到狀態樹,因爲屬順序問題
  3. window.addEventListener('beforeunload', ()=> {
  4. // sessionStorage.setItem("storeCache",JSON.stringify(ctx.store.state))
  5. });
  6. //页面加载完成 将session中的store数据
  7. window.addEventListener('load', ()=> {
  8. // let storeCache = sessionStorage.getItem("storeCache")
  9. // if(storeCache){
  10. // // 将session中的store数据替换到store中
  11. // ctx.store.replaceState(JSON.parse(storeCache));
  12. // }
  13. });
  14. }