state.ts 577 B

1234567891011121314151617181920212223242526272829
  1. import cookie from 'js-cookie';
  2. export interface AppState {
  3. user: User;
  4. token: string;
  5. mobile: boolean;
  6. background: string;
  7. activeTabName: 'message' | 'contacts';
  8. apiUrl: string;
  9. loading: boolean;
  10. }
  11. const appState: AppState = {
  12. user: {
  13. userId: '',
  14. username: '',
  15. password: '',
  16. avatar: '',
  17. createTime: 0,
  18. },
  19. token: cookie.get('token') as string,
  20. mobile: false,
  21. background: '',
  22. activeTabName: 'message',
  23. apiUrl: process.env.VUE_APP_API_URL, // 后台api地址
  24. loading: false, // 全局Loading状态
  25. };
  26. export default appState;