| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 
 | import { action  } from "mobx"import { makeAutoObservable } from "mobx"
 import { makePersistable } from "mobx-persist-store";
 
 
 
 class AppState {
 user_info: {
 avatar: string,
 gender: number,
 nickname: string,
 phone: string,
 } | undefined = undefined;
 constructor() {
 makeAutoObservable(this, {}, { autoBind: true })
 makePersistable(this, {
 name:'mainStore',
 properties: [
 "user_info"
 ],
 storage: window.localStorage,
 expireIn: 86400000,
 removeOnExpiration: true,
 debugMode: false,
 })
 .then(
 action((persistStore: {
 rehydrated: boolean;
 rehydrate: () => void;
 }) => {
 
 console.log('mainStore持久化加载完成',persistStore);
 }
 ))
 }
 setUserInfo(userInfo: { avatar: string; gender: number; nickname: string; phone: string; } | undefined) {
 this.user_info = userInfo;
 }
 
 }
 
 export const appState = new AppState()
 
 |