App.vue 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <script>
  2. import config from './config'
  3. import store from '@/store'
  4. import {getToken} from '@/utils/auth'
  5. export default {
  6. onLaunch: function() {
  7. console.log('App Launch')
  8. this.initApp()
  9. },
  10. onShow: function() {
  11. console.log('App Show')
  12. },
  13. onHide: function() {
  14. console.log('App Hide')
  15. },
  16. methods: {
  17. // 初始化应用
  18. initApp() {
  19. // 初始化应用配置
  20. this.initConfig()
  21. // 检查用户登录状态
  22. //#ifdef H5
  23. this.checkLogin()
  24. //#endif
  25. },
  26. initConfig() {
  27. this.globalData.config = config
  28. },
  29. checkLogin() {
  30. // if (!getToken()) {
  31. // this.$tab.reLaunch('/pages/login')
  32. // }
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss">
  38. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  39. @import "@/uni_modules/uview-ui/index.scss";
  40. @import "@/static/style/index.scss";
  41. </style>