main.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import Vue from "vue";
  2. import App from "./App";
  3. import store from "./store";
  4. import MinCache from "./common/util/MinCache.js";
  5. import tip from "./common/util/tip.js";
  6. import configService from "./common/service/config.service.js";
  7. import router from "./common/router";
  8. import { RouterMount } from "./plugin/uni-simple-router/index.js";
  9. // 注册缓存器
  10. Vue.use(MinCache, { timeout: 6 });
  11. // store
  12. Vue.prototype.$store = store;
  13. // tip
  14. Vue.prototype.$tip = tip;
  15. // config
  16. Vue.prototype.$config = configService;
  17. import uView from "@/uni_modules/uview-ui";
  18. Vue.use(uView);
  19. // request请求
  20. import { http } from "@/common/service/service.js";
  21. Vue.prototype.$http = http;
  22. import home from "./pages/home/home.vue";
  23. Vue.component("home", home);
  24. import operation from "./pages/operation/operation.vue";
  25. Vue.component("operation", operation);
  26. import camera from "./pages/camera/camera.vue";
  27. Vue.component("camera", camera);
  28. import history from "./pages/history/history.vue";
  29. Vue.component("history", history);
  30. import warndata from "./pages/warndata/warndata.vue";
  31. Vue.component("warndata", warndata);
  32. // 自定义组件
  33. import mySelect from "./components/my-componets/my-select.vue";
  34. Vue.component("mySelect", mySelect);
  35. import myImageUpload from "./components/my-componets/my-image-upload.vue";
  36. Vue.component("myImageUpload", myImageUpload);
  37. import myPage from "./components/my-componets/my-page.vue";
  38. Vue.component("myPage", myPage);
  39. import basics from "./pages/basics/home.vue";
  40. Vue.component("basics", basics);
  41. import components from "./pages/component/home.vue";
  42. Vue.component("components", components);
  43. import plugin from "./pages/plugin/home.vue";
  44. Vue.component("plugin", plugin);
  45. import cuCustom from "./plugin/colorui/components/cu-custom.vue";
  46. Vue.component("cu-custom", cuCustom);
  47. // import VConsole from './js_sdk/vconsole.min'
  48. // var vConsole = new VConsole();
  49. Vue.config.productionTip = false;
  50. App.mpType = "app";
  51. const app = new Vue({
  52. store,
  53. MinCache,
  54. ...App,
  55. });
  56. //v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
  57. // #ifdef H5
  58. RouterMount(app, "#app");
  59. // #endif
  60. // #ifndef H5
  61. app.$mount(); //为了兼容小程序及app端必须这样写才有效果
  62. // #endif