main.js 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import Vue from 'vue'
  2. import App from './App'
  3. import uView from 'uview-ui';
  4. Vue.use(uView);
  5. //封装api
  6. import { api } from 'assets/http/api.js'
  7. Vue.prototype.$api = api
  8. //引入util.js
  9. import Util from 'utils/util.js'
  10. Vue.prototype.$util = Util
  11. //封装缓存
  12. import simpleCache from "@/utils/cache.js"
  13. Vue.prototype.$cache = simpleCache
  14. //封装判空函数
  15. Vue.prototype.$isEmpty=function(value){
  16. switch (typeof value) {
  17. case 'undefined':
  18. return true;
  19. case 'string':
  20. if(value=='undefined') return true
  21. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  22. break;
  23. case 'boolean':
  24. if (!value) return true;
  25. break;
  26. case 'number':
  27. if (0 === value || isNaN(value)) return true;
  28. break;
  29. case 'object':
  30. if (null === value || value.length === 0) return true;
  31. for (var i in value) {
  32. return false;
  33. }
  34. return true;
  35. }
  36. return false;
  37. }
  38. Vue.config.productionTip = false
  39. App.mpType = 'app'
  40. const app = new Vue({
  41. ...App
  42. })
  43. app.$mount()