YM
2024-05-27 0edf94722a0dcc338567fec7df76b2e0acd39b92
src/store/index.js
@@ -14,7 +14,6 @@
   getters,
   mutations:{
      Set_UserName(state,username){
         console.log(username,'uuu');
         state.username=username
      }
   },
@@ -29,11 +28,9 @@
      // 监听mutaions 记录state到本地存储
      store.subscribe((mutation,state)=>{
         uni.setStorageSync('state',state)
         console.log(state,'statestatestate');
      })
      // 读取缓存中state
      if(uni.getStorageSync('state')){
         // console.log(state,'aaaaaaaaastatestatestate');
         store.replaceState(Object.assign({},store.state,uni.getStorageSync('state')))
      }
   }]