main.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import Vue from 'vue'
  2. import App from './App'
  3. // // 自定义插件
  4. import MyHttp from './core/http/index.js'
  5. import MyStore from './core/store/index'
  6. import MyUtils from './core/untils/index'
  7. import MyCatch from './core/cache/index'
  8. import MyConfig from './core/config/index'
  9. import MyUserLogin from './core/login'
  10. import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
  11. import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue"
  12. let share= require('./lib/config/share.js');
  13. Vue.mixin(share)
  14. App.mpType = 'app'
  15. //微信h5授权登录时使用此代码
  16. import RouterMount from '@/core/http/useRouter.js'
  17. Vue.component('mescroll-body', MescrollBody)
  18. Vue.component('mescroll-uni', MescrollUni)
  19. Vue.prototype.$store = MyStore
  20. Vue.prototype.$myHttp = MyHttp // http
  21. Vue.prototype.$myUtils = MyUtils // utils, 包含表单验证、错误处理、页面跳转、消息提示
  22. Vue.prototype.$myCatch = MyCatch // catch
  23. Vue.prototype.$myConfig = MyConfig // config
  24. Vue.prototype.$myUserLogin = MyUserLogin // MyUserLogin
  25. Vue.prototype.$openrul = function (_url) {
  26. MyUtils.$router.navigateTo({
  27. url: _url
  28. })
  29. }
  30. Vue.prototype.$navigateBack = function () {
  31. MyUtils.$router.navigateBack()
  32. }
  33. Vue.prototype.$redirectTo = function (_url) {
  34. MyUtils.$router.redirectTo({
  35. url: _url
  36. })
  37. }
  38. Vue.config.productionTip = false
  39. App.mpType = 'app'
  40. const app = new Vue({
  41. MyStore,
  42. ...App
  43. })
  44. // #ifdef H5
  45. if(MyConfig.mode == 1){
  46. //微信h5授权登录时使用此代码
  47. RouterMount(app,'#app');
  48. }else{
  49. app.$mount();
  50. }
  51. // #endif
  52. // #ifdef MP-WEIXIN
  53. //小程序授权登录时使用此代码
  54. app.$mount();
  55. // #endif
  56. // #ifdef APP-PLUS
  57. //app
  58. app.$mount();
  59. // #endif