main.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. Vue.config.productionTip = false;
  5. //组件库
  6. import uView from '@/uni_modules/uview-ui'
  7. Vue.use(uView)
  8. //colorui 自定义顶部nav
  9. import cuCustom from './colorui/components/cu-custom.vue'
  10. Vue.component('cu-custom', cuCustom)
  11. import timeHorizon from './components/timeHorizon'
  12. Vue.component('time-horizon', timeHorizon)
  13. import controlItem from "./control/modules/controlItem.vue"
  14. Vue.component('control-item', controlItem)
  15. import My_input from "./control/modules/My_input.vue"
  16. Vue.component('My_input', My_input)
  17. //自定义组件
  18. import My_listbox from './components/My_listbox';
  19. Vue.component('My_listbox', My_listbox);
  20. import My_search from './components/My_search';
  21. Vue.component('My_search', My_search);
  22. import My_form from './components/My_form';
  23. Vue.component('My_form', My_form);
  24. import My_Files from './components/My_Files';
  25. Vue.component('My_Files', My_Files);
  26. //挂载接口
  27. let isDev = process.env.NODE_ENV === 'development';
  28. console.log('运行环境', isDev ? '开发' : '生产');
  29. const http = {};
  30. // #ifdef H5
  31. http.baseUrl = isDev ? "/apis1" : "/apis";
  32. http.socket = isDev ? "/socket1" : "/socket";
  33. // #endif
  34. // #ifndef H5
  35. http.baseUrl = isDev ? "http://60.204.153.188" : "https://www.ibpchina.com.cn";
  36. http.socket = isDev ? "ws://60.204.153.188" : "wss://www.ibpchina.com.cn";
  37. // #endif
  38. console.log("接口地址", http)
  39. import {
  40. ApiModel
  41. } from './utils/api'
  42. Vue.prototype.$Http = new ApiModel(http);
  43. import {
  44. Socket
  45. } from './utils/Socket'
  46. Vue.prototype.$Socket = new Socket(http);
  47. App.mpType = 'app'
  48. const app = new Vue({
  49. ...App
  50. })
  51. app.$mount()
  52. // #endif
  53. // #ifdef VUE3
  54. import {
  55. createSSRApp
  56. } from 'vue'
  57. export function createApp() {
  58. const app = createSSRApp(App)
  59. return {
  60. app
  61. }
  62. }
  63. // #endif