main.js 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. Vue.config.productionTip = false
  5. App.mpType = 'app'
  6. const app = new Vue({
  7. ...App
  8. })
  9. app.$mount()
  10. // #endif
  11. // #ifdef VUE3
  12. import { createSSRApp } from 'vue'
  13. export function createApp() {
  14. const app = createSSRApp(App)
  15. return {
  16. app
  17. }
  18. }
  19. // #endif
  20. Vue.prototype.$token = false
  21. Vue.prototype.$userInfo = null
  22. uni.getStorage({
  23. key: "userInfo",
  24. success(_data) {
  25. Vue.prototype.$userInfo = _data.data
  26. },
  27. fail() {
  28. Vue.prototype.$userInfo = null
  29. }
  30. })
  31. uni.getStorage({
  32. key: "Authorization",
  33. success(_data) {
  34. console.log(_data)
  35. Vue.prototype.$token = _data.data
  36. },
  37. fail() {
  38. Vue.prototype.$token = false
  39. }
  40. })
  41. //公用链接
  42. import env from '@/util/env.js'
  43. Vue.prototype.$baseUrl = env.baseUrl
  44. //公用请求
  45. import httpServer from "@/util/http.js"
  46. Vue.prototype.$get = httpServer.get
  47. Vue.prototype.$post = httpServer.post
  48. import Mixin from './polyfill/mixins'
  49. Vue.mixin(Mixin)