main.js 920 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // #ifndef VUE3
  2. import Vue from 'vue'
  3. import App from './App'
  4. // 导入网络请求的包
  5. import { $http } from '@escook/request-miniprogram'
  6. uni.$http = $http
  7. // 请求拦截器
  8. $http.beforeRequest = function(options) {
  9. uni.showLoading({
  10. title: '数据加载中'
  11. })
  12. }
  13. // 请求的根路径
  14. $http.baseUrl = 'https://www.uinav.com'
  15. // 响应拦截器
  16. import { $http } from '@escook/request-miniprogram'
  17. $http.afterRequest = function() {
  18. uni.hideLoading()
  19. }
  20. // 封装弹窗的方法
  21. uni.$showMsg = function (title = '数据加载失败!', duration = 1500) {
  22. uni.showToast({
  23. title,
  24. duration,
  25. icon: 'none',
  26. })
  27. }
  28. Vue.config.productionTip = false
  29. App.mpType = 'app'
  30. const app = new Vue({
  31. ...App
  32. })
  33. app.$mount()
  34. // #endif
  35. // #ifdef VUE3
  36. import { createSSRApp } from 'vue'
  37. import App from './App.vue'
  38. export function createApp() {
  39. const app = createSSRApp(App)
  40. return {
  41. app
  42. }
  43. }
  44. // #endif