main.js 1.6 KB

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