main.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import Vue from 'vue';
  2. import App from './App';
  3. import store from '@/store';
  4. // 混入
  5. import goPage from '@/mixin/goPage.js';
  6. import uView from "uview-ui";
  7. Vue.use(uView);
  8. // 公共处理函数
  9. import * as utils from './common/utils.js';
  10. // 新增按钮,全部组件
  11. import addBtn from './components/AddData.vue'
  12. // 空白页面,全局组件
  13. import empty from '@/components/empty/index.vue'
  14. // 手机顶部状态栏,全局组件
  15. import uniStatusBar from '@/components/uni-status-bar.vue';
  16. // 数字精度计算
  17. import NP from "number-precision";
  18. // 权限
  19. import { checkActionAccess } from "@/common/check";
  20. import * as nodes from "@/common/node";
  21. import Tabbar from '@/components/Tabbar/index';
  22. Vue.component('Tabbar', Tabbar)
  23. Vue.prototype.$accessCheck = checkActionAccess;
  24. Vue.prototype.$Access = nodes;
  25. Vue.prototype.$utils = utils;
  26. Vue.prototype.$store = store;
  27. Vue.prototype.$NP = NP; // 高精度数学计算
  28. Vue.mixin(goPage)
  29. Vue.component('addBtn', addBtn)
  30. Vue.component('Aempty', empty)
  31. Vue.component('uniStatusBar', uniStatusBar)
  32. /* 获取上页的数据 */
  33. Vue.prototype._prePage = () => {
  34. let pages = getCurrentPages();
  35. let prePage = pages[pages.length - 2];
  36. // #ifdef H5
  37. return prePage;
  38. // #endif
  39. return prePage.$vm;
  40. }
  41. Vue.config.productionTip = false
  42. App.mpType = 'app'
  43. const app = new Vue({
  44. ...App
  45. })
  46. // http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
  47. import httpInterceptor from '@/common/http.interceptor.js'
  48. Vue.use(httpInterceptor, app)
  49. // http接口API集中管理引入部分
  50. import httpApi from '@/common/http.api.js'
  51. Vue.use(httpApi, app)
  52. app.$mount()