main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. import toast from '@/components/toast/toast.vue'
  11. Vue.use(toast)
  12. import loading from '@/components/loading/loading.vue'
  13. Vue.use(loading)
  14. //mescroll
  15. import MescrollBody from "@/components/mescroll-body/mescroll-body.vue"
  16. Vue.component('MescrollBody', MescrollBody)
  17. //封装api
  18. import { api } from 'assets/http/api.js'
  19. Vue.prototype.$api = api
  20. //缓存
  21. import simpleCache from "@/utils/cache.js"
  22. Vue.prototype.$cache = simpleCache
  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 Global from './utils/global'
  31. Vue.prototype.$global = Global
  32. //数字处理
  33. import digital from './utils/digital.js'
  34. Vue.prototype.$digital = digital
  35. // 全局注入
  36. import Mixin from './utils/mixin'
  37. Vue.mixin(Mixin)
  38. // 微信函数封装
  39. import Mpi from './utils/mpi'
  40. Vue.prototype.$mpi = Mpi
  41. //引入工具类
  42. import util from 'utils/util.js'
  43. Vue.prototype.$util = util
  44. //校验文件
  45. import verify from 'utils/verify.js'
  46. Vue.prototype.$verify = verify
  47. //跳转
  48. Vue.prototype.$jump=function(url){
  49. uni.navigateTo({
  50. url
  51. })
  52. }
  53. Vue.prototype.$back=function(){
  54. uni.navigateBack({
  55. delta:1
  56. })
  57. }
  58. //判空函数
  59. Vue.prototype.$isEmpty=function(value){
  60. switch (typeof value) {
  61. case 'undefined':
  62. return true;
  63. case 'string':
  64. if(value=='undefined') return true
  65. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  66. break;
  67. case 'boolean':
  68. if (!value) return true;
  69. break;
  70. case 'number':
  71. if (0 === value || isNaN(value)) return true;
  72. break;
  73. case 'object':
  74. if (null === value || value.length === 0) return true;
  75. for (var i in value) {
  76. return false;
  77. }
  78. return true;
  79. }
  80. return false;
  81. }
  82. Vue.prototype.$isNotEmpty=function(value){
  83. switch (typeof value) {
  84. case 'undefined':
  85. return false;
  86. case 'string':
  87. if(value=='undefined') return false
  88. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return false;
  89. break;
  90. case 'boolean':
  91. if (!value) return false;
  92. break;
  93. case 'number':
  94. if (0 === value || isNaN(value)) return false;
  95. break;
  96. case 'object':
  97. if (null === value || value.length === 0) return false;
  98. for (var i in value) {
  99. return true;
  100. }
  101. return false;
  102. }
  103. return true;
  104. }
  105. Vue.config.productionTip = false
  106. App.mpType = 'app'
  107. const app = new Vue({
  108. store,
  109. ...App
  110. })
  111. app.$mount()