main.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import Vue from 'vue'
  2. import App from './App'
  3. //uview 组件
  4. import uView from 'uview-ui';
  5. Vue.use(uView);
  6. import addBtn from '@/components/addBtn/addBtn.vue'
  7. Vue.component('addBtn',addBtn)
  8. //mescroll
  9. import MescrollBody from "@/components/mescroll-body/mescroll-body.vue"
  10. Vue.component('mescroll-body', MescrollBody)
  11. //封装api
  12. import { api } from 'assets/http/api.js'
  13. Vue.prototype.$api = api
  14. //全局变量
  15. import Global from './utils/global'
  16. Vue.prototype.$global = Global
  17. //缓存
  18. import simpleCache from "@/utils/cache.js"
  19. Vue.prototype.$cache = simpleCache
  20. //校验文件
  21. import verify from 'utils/verify.js'
  22. Vue.prototype.$verify = verify
  23. //封装日期时间工具类
  24. import dateTime from 'utils/dateTime.js'
  25. Vue.prototype.$dateTime = dateTime
  26. //封装提示工具
  27. import dialog from 'utils/dialog.js'
  28. Vue.prototype.$dialog = dialog
  29. //引入工具类
  30. import util from 'utils/util.js'
  31. Vue.prototype.$util = util
  32. //uview 封装提示框
  33. Vue.prototype.$showToast=function(title,type,position){
  34. this.$refs.uToast.show({
  35. title: title,
  36. position:position||'top',
  37. type: type ||'success'
  38. })
  39. }
  40. /**封装判空函数
  41. * @param {Object} value
  42. */
  43. Vue.prototype.$isEmpty=function(value){
  44. switch (typeof value) {
  45. case 'undefined':
  46. return true;
  47. case 'string':
  48. if(value=='undefined') return true
  49. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  50. break;
  51. case 'boolean':
  52. if (!value) return true;
  53. break;
  54. case 'number':
  55. if (0 === value || isNaN(value)) return true;
  56. break;
  57. case 'object':
  58. if (null === value || value.length === 0) return true;
  59. for (var i in value) {
  60. return false;
  61. }
  62. return true;
  63. }
  64. return false;
  65. }
  66. Vue.config.productionTip = false
  67. App.mpType = 'app'
  68. const app = new Vue({
  69. ...App
  70. })
  71. app.$mount()