main.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import Vue from 'vue'
  2. import App from './App'
  3. //store
  4. import store from '@/store';
  5. let vuexStore = require("@/store/$u.mixin.js");
  6. Vue.mixin(vuexStore);
  7. //uView
  8. import uView from "uview-ui";
  9. Vue.use(uView);
  10. //mescroll
  11. import MescrollBody from "@/components/mescroll-body/mescroll-body.vue"
  12. Vue.component('MescrollBody', MescrollBody)
  13. //封装api
  14. import { api } from 'assets/http/api.js'
  15. Vue.prototype.$api = api
  16. //缓存
  17. import simpleCache from "@/utils/cache.js"
  18. Vue.prototype.$cache = simpleCache
  19. //封装日期时间工具类
  20. import dateTime from 'utils/dateTime.js'
  21. Vue.prototype.$dateTime = dateTime
  22. //封装提示工具
  23. import dialog from 'utils/dialog.js'
  24. Vue.prototype.$dialog = dialog
  25. //数字处理
  26. import digital from './utils/digital.js'
  27. Vue.prototype.$digital = digital
  28. // 全局注入
  29. import Mixin from './utils/mixin'
  30. Vue.mixin(Mixin)
  31. // 微信函数封装
  32. import Mpi from './utils/mpi'
  33. Vue.prototype.$mpi = Mpi
  34. //引入工具类
  35. import util from 'utils/util.js'
  36. Vue.prototype.$util = util
  37. //校验文件
  38. import verify from 'utils/verify.js'
  39. Vue.prototype.$verify = verify
  40. //全局变量
  41. import global from './assets/http/global.js'
  42. Vue.prototype.$global = global
  43. //跳转
  44. Vue.prototype.$jump=function(url,events){
  45. uni.navigateTo({
  46. url,
  47. events
  48. })
  49. }
  50. //判空函数
  51. Vue.prototype.$isEmpty=function(value){
  52. switch (typeof value) {
  53. case 'undefined':
  54. return true;
  55. case 'string':
  56. if(value=='undefined') return true
  57. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  58. break;
  59. case 'boolean':
  60. if (!value) return true;
  61. break;
  62. case 'number':
  63. if (0 === value || isNaN(value)) return true;
  64. break;
  65. case 'object':
  66. if (null === value || value.length === 0) return true;
  67. for (var i in value) {
  68. return false;
  69. }
  70. return true;
  71. }
  72. return false;
  73. }
  74. Vue.config.productionTip = false
  75. App.mpType = 'app'
  76. const app = new Vue({
  77. store,
  78. ...App
  79. })
  80. app.$mount()