main.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import Vue from 'vue'
  2. import App from './App'
  3. // 引入全局存储
  4. import store from './store'
  5. // 引入全局配置
  6. import $mAssetsPath from '@/config/assets.config.js';
  7. import $mConfig from '@/config/global.config.js';
  8. // 引入全局方法
  9. import {
  10. http
  11. } from '@/common/request/index.js';
  12. import {
  13. shopHttp
  14. } from '@/common/request/index-shop.js';
  15. import $mUtil from '@/common/util.js';
  16. // 全局组件
  17. import navbar from '@/components/hx-navbar/hx-navbar.nvue';
  18. import ldLoading from '@/components/ld-loading/index.vue';
  19. import nodata from '@/components/noData/nodata.vue';
  20. import loadMore from '@/components/uni-load-more/uni-load-more.vue';
  21. import Directives from './directives/index.js';
  22. // import '@/common/jswx.js'
  23. // 网络状态监听
  24. // uni.getNetworkType({
  25. // success: res => {
  26. // console.log(res)
  27. // store.dispatch('networkStateChange', res.networkType);
  28. // }
  29. // });
  30. // uni.onNetworkStatusChange(function (res) {
  31. // console.log(res+'onNetworkStatusChange')
  32. // store.dispatch('networkStateChange', res.networkType);
  33. // });
  34. if (process.env.NODE_ENV === 'production') {
  35. Vue.config.productionTip = false;
  36. Vue.config.ignoredElements.push('wx-open-launch-weapp')
  37. }
  38. // 挂载全局自定义方法
  39. Vue.prototype.$store = store
  40. Vue.prototype.$adpid = ""
  41. Vue.prototype.$http = http;
  42. Vue.prototype.$shopHttp = shopHttp;
  43. Vue.prototype.$mConfig = $mConfig;
  44. Vue.prototype.$mAssetsPath = $mAssetsPath;
  45. Vue.prototype.$mUtil = $mUtil;
  46. Vue.component('navbar', navbar);
  47. Vue.component('ldLoading', ldLoading);
  48. Vue.component('nodata', nodata);
  49. Vue.component('loadMore', loadMore);
  50. App.mpType = 'app'
  51. import uView from "uview-ui";
  52. Vue.use(uView);
  53. Vue.use(Directives);
  54. // 保留小数点后两位
  55. Vue.filter('keepTwo', value => {
  56. return (Math.floor((value || 0) * 100) / 100).toFixed(2);
  57. });
  58. // import Vue from 'vue'
  59. /**
  60. * 注册指令
  61. */
  62. const app = new Vue({
  63. store,
  64. ...App
  65. })
  66. app.$mount()