main.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 Global from './utils/global'
  27. Vue.prototype.$global = Global
  28. //数字处理
  29. import digital from './utils/digital.js'
  30. Vue.prototype.$digital = digital
  31. // 全局注入
  32. import Mixin from './utils/mixin'
  33. Vue.mixin(Mixin)
  34. // 微信函数封装
  35. import Mpi from './utils/mpi'
  36. Vue.prototype.$mpi = Mpi
  37. //引入工具类
  38. import util from 'utils/util.js'
  39. Vue.prototype.$util = util
  40. //校验文件
  41. import verify from 'utils/verify.js'
  42. Vue.prototype.$verify = verify
  43. //跳转
  44. Vue.prototype.$jump=function(url){
  45. uni.navigateTo({
  46. url
  47. })
  48. }
  49. Vue.prototype.$back=function(){
  50. uni.navigateBack({
  51. delta:1
  52. })
  53. }
  54. //判空函数
  55. Vue.prototype.$isEmpty=function(value){
  56. switch (typeof value) {
  57. case 'undefined':
  58. return true;
  59. case 'string':
  60. if(value=='undefined') return true
  61. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  62. break;
  63. case 'boolean':
  64. if (!value) return true;
  65. break;
  66. case 'number':
  67. if (0 === value || isNaN(value)) return true;
  68. break;
  69. case 'object':
  70. if (null === value || value.length === 0) return true;
  71. for (var i in value) {
  72. return false;
  73. }
  74. return true;
  75. }
  76. return false;
  77. }
  78. Vue.config.productionTip = false
  79. App.mpType = 'app'
  80. const app = new Vue({
  81. store,
  82. ...App
  83. })
  84. app.$mount()