main.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from "store";
  4. import uView from "uview-ui";
  5. Vue.use(uView);
  6. Vue.config.productionTip = false
  7. import {
  8. Base64
  9. } from 'js-base64'
  10. Vue.prototype.$Base64 = Base64
  11. import {
  12. toast,
  13. successToast,
  14. showLoading,
  15. tipLoading,
  16. hideLoading,
  17. modal,
  18. navPage,
  19. redPage,
  20. backPage,
  21. callPhone,
  22. copy,
  23. } from "common/utils/common"
  24. import {
  25. navToPage
  26. } from "common/utils/navPag"
  27. Vue.prototype.$navToPage = navToPage;
  28. Vue.prototype.$H5Href = process.env.VUE_APP_HREF;
  29. Vue.prototype.$toast = toast;
  30. Vue.prototype.$successToast = successToast;
  31. Vue.prototype.$showLoading = showLoading;
  32. Vue.prototype.$tipLoading = tipLoading;
  33. Vue.prototype.$hideLoading = hideLoading;
  34. Vue.prototype.$modal = modal;
  35. Vue.prototype.$navPage = navPage;
  36. Vue.prototype.$redPage = redPage;
  37. Vue.prototype.$backPage = backPage;
  38. Vue.prototype.$callPhone = callPhone;
  39. Vue.prototype.$copy = copy;
  40. // 注入全局
  41. import pages from 'mixins';
  42. Vue.mixin(pages);
  43. App.mpType = 'app'
  44. import api from '@/common/http/'
  45. Vue.prototype.$api = api
  46. import * as filters from './filters/index.js' // global filters
  47. // register global utility filters
  48. Object.keys(filters).forEach(key => {
  49. Vue.filter(key, filters[key])
  50. })
  51. import custom from '@/components/custom.vue';
  52. import Loading from '@/components/Loading.vue';
  53. import zjPageLayout from "@/components/zj-container/zj-page-layout.vue"
  54. Vue.component('custom', custom);
  55. Vue.component('Loading', Loading);
  56. Vue.component('zjPageLayout', zjPageLayout);
  57. import {
  58. getUserInfo
  59. } from "@/common/utils/util.js";
  60. Vue.prototype.$getUserInfo = getUserInfo;
  61. // #ifdef H5
  62. import {
  63. router,
  64. RouterMount
  65. } from 'router'
  66. Vue.use(router)
  67. import Mylink from 'uni-simple-router/dist/link.vue'
  68. // 组件式导航
  69. Vue.component('my-link', Mylink)
  70. // #endif
  71. // 渲染图片文件
  72. Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + '/file/img/get?key=';
  73. const app = new Vue({
  74. ...App,
  75. store
  76. })
  77. //v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
  78. // #ifdef H5
  79. RouterMount(app, router, '#app')
  80. // #endif
  81. // #ifndef H5
  82. app.$mount(); //为了兼容小程序及app端必须这样写才有效果
  83. // #endif