main.js 916 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // 引入全局uView
  2. import uView from 'uview-ui';
  3. Vue.use(uView);
  4. // #ifndef VUE3
  5. import Vue from 'vue'
  6. import App from './App'
  7. import store from './pages/store/index.js'
  8. Vue.prototype.$store = store
  9. import moment from 'moment'
  10. Vue.prototype.$moment = moment;
  11. // 按需导入 $http 对象
  12. import { $http } from '@escook/request-miniprogram'
  13. uni.$http = $http
  14. //请求根路径
  15. $http.baseUrl = 'https://cloud.long-chi.com'
  16. //请求拦截器
  17. $http.beforeRequest = function(options){
  18. uni.showLoading({
  19. title:'数据加载中'
  20. })
  21. }
  22. //响应拦截器
  23. $http.afterRequest = function(options){
  24. uni.hideLoading()
  25. }
  26. Vue.config.productionTip = false
  27. App.mpType = 'app'
  28. const app = new Vue({
  29. ...App,
  30. store
  31. })
  32. app.$mount()
  33. // #endif
  34. // #ifdef VUE3
  35. import { createSSRApp } from 'vue'
  36. import App from './App.vue'
  37. export function createApp() {
  38. const app = createSSRApp(App)
  39. return {
  40. app
  41. }
  42. }
  43. // #endif