main.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.$isWxBrowser = () => {
  45. let flag=false
  46. try{
  47. let na = navigator.userAgent.toLowerCase();
  48. flag=na.indexOf('micromessenger') !== -1
  49. }catch(e){
  50. flag=false
  51. }
  52. return flag;
  53. }
  54. //跳转
  55. Vue.prototype.$jump=function(url,events){
  56. uni.navigateTo({
  57. url,
  58. events
  59. })
  60. }
  61. Vue.prototype.$back=function(){
  62. uni.navigateBack({
  63. delta:1
  64. })
  65. }
  66. //判空函数
  67. Vue.prototype.$isEmpty=function(value){
  68. switch (typeof value) {
  69. case 'undefined':
  70. return true;
  71. case 'string':
  72. if(value=='undefined') return true
  73. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  74. break;
  75. case 'boolean':
  76. if (!value) return true;
  77. break;
  78. case 'number':
  79. if (0 === value || isNaN(value)) return true;
  80. break;
  81. case 'object':
  82. if (null === value || value.length === 0) return true;
  83. for (var i in value) {
  84. return false;
  85. }
  86. return true;
  87. }
  88. return false;
  89. }
  90. Vue.config.productionTip = false
  91. App.mpType = 'app'
  92. const app = new Vue({
  93. store,
  94. ...App
  95. })
  96. app.$mount()