main.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import Vue from 'vue';
  2. import App from './App';
  3. Vue.config.productionTip = false;
  4. import { config } from './common/config';
  5. Vue.prototype.config = config;
  6. // 项目标识
  7. Vue.prototype.projectFlag = config.projectFlag;
  8. if (process.env.H_NODE_ENV !== 'production') {
  9. const vconsole = require('vconsole')
  10. Vue.prototype.$vconsole = new vconsole()
  11. }
  12. import './utils/filter';
  13. App.mpType = 'app';
  14. // 引入全局uView
  15. import uView from 'uview-ui';
  16. Vue.use(uView);
  17. // 此处为演示vuex使用,非uView的功能部分
  18. import store from '@/store';
  19. // 引入uView提供的对vuex的简写法文件
  20. let vuexStore = require('@/store/$u.mixin.js');
  21. Vue.mixin(vuexStore);
  22. const app = new Vue({
  23. store,
  24. ...App
  25. });
  26. // http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
  27. import httpInterceptor from '@/common/http.interceptor.js';
  28. Vue.use(httpInterceptor, app);
  29. // http接口API抽离,免于写url或者一些固定的参数
  30. import httpApi from '@/common/http.api.js';
  31. Vue.use(httpApi, app);
  32. app.$mount();