main.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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/wx/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. Vue.config.ignoredElements.push('wx-open-launch-app')
  35. if (process.env.NODE_ENV === 'production') {
  36. Vue.config.productionTip = false;
  37. Vue.config.ignoredElements.push('wx-open-launch-app')
  38. // Vue.config.ignoredElements.push('wx-open-launch-weapp')
  39. }
  40. // 挂载全局自定义方法
  41. Vue.prototype.$store = store
  42. Vue.prototype.$adpid = ""
  43. Vue.prototype.$http = http;
  44. Vue.prototype.$shopHttp = shopHttp;
  45. Vue.prototype.$mConfig = $mConfig;
  46. Vue.prototype.$mAssetsPath = $mAssetsPath;
  47. Vue.prototype.$mUtil = $mUtil;
  48. Vue.component('navbar', navbar);
  49. Vue.component('ldLoading', ldLoading);
  50. Vue.component('nodata', nodata);
  51. Vue.component('loadMore', loadMore);
  52. App.mpType = 'app'
  53. import uView from "uview-ui";
  54. Vue.use(uView);
  55. Vue.use(Directives);
  56. // 保留小数点后两位
  57. Vue.filter('keepTwo', value => {
  58. return (Math.floor((value || 0) * 100) / 100).toFixed(2);
  59. });
  60. // import Vue from 'vue'
  61. /**
  62. * 注册指令
  63. */
  64. const app = new Vue({
  65. store,
  66. ...App
  67. })
  68. app.$mount()