main.js 2.2 KB

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