App.vue 984 B

12345678910111213141516171819202122232425262728293031323334
  1. <script>
  2. export default {
  3. // 此处globalData为了演示其作用,不是uView框架的一部分
  4. globalData: {
  5. username: '白居易'
  6. },
  7. created() {
  8. if (uni.getStorageSync('lifeData').vuex_token) {
  9. uni.switchTab({
  10. url: '/pages/home/home'
  11. })
  12. } else {
  13. uni.redirectTo({
  14. url: '/pages/login/login'
  15. });
  16. }
  17. },
  18. onLaunch() {
  19. // 1.1.0版本之前关于http拦截器代码,已平滑移动到/common/http.interceptor.js中
  20. // 注意,需要在/main.js中实例化Vue之后引入如下(详见文档说明):
  21. // import httpInterceptor from '@/common/http.interceptor.js'
  22. // Vue.use(httpInterceptor, app)
  23. // process.env.VUE_APP_PLATFORM 为通过js判断平台名称的方法,结果分别如下:
  24. /**
  25. * h5,app-plus(nvue下也为app-plus),mp-weixin,mp-alipay......
  26. */
  27. },
  28. }
  29. </script>
  30. <style lang="scss">
  31. @import "uview-ui/index.scss";
  32. @import "common/demo.scss";
  33. </style>