import Vue from 'vue' import App from './App' //uview 组件 import uView from 'uview-ui'; Vue.use(uView); import addBtn from '@/components/addBtn/addBtn.vue' Vue.component('addBtn',addBtn) //mescroll import MescrollBody from "@/components/mescroll-body/mescroll-body.vue" Vue.component('mescroll-body', MescrollBody) //封装api import { api } from 'assets/http/api.js' Vue.prototype.$api = api //全局变量 import Global from './utils/global' Vue.prototype.$global = Global //缓存 import simpleCache from "@/utils/cache.js" Vue.prototype.$cache = simpleCache //校验文件 import verify from 'utils/verify.js' Vue.prototype.$verify = verify //封装日期时间工具类 import dateTime from 'utils/dateTime.js' Vue.prototype.$dateTime = dateTime //封装提示工具 import dialog from 'utils/dialog.js' Vue.prototype.$dialog = dialog //引入工具类 import util from 'utils/util.js' Vue.prototype.$util = util //uview 封装提示框 Vue.prototype.$showToast=function(title,type,position){ this.$refs.uToast.show({ title: title, position:position||'top', type: type ||'success' }) } //封装提示框 Vue.prototype.$showModel = (content,isShowCancel=true,title='提示',)=>{ return new Promise((resolve,reject)=>{ uni.showModal({ title: title, content: content, showCancel:isShowCancel, success: (res)=>{ if (res.confirm) { resolve(res) } } }); }) } /**封装判空函数 * @param {Object} value */ Vue.prototype.$isEmpty=function(value){ switch (typeof value) { case 'undefined': return true; case 'string': if(value=='undefined') return true if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true; break; case 'boolean': if (!value) return true; break; case 'number': if (0 === value || isNaN(value)) return true; break; case 'object': if (null === value || value.length === 0) return true; for (var i in value) { return false; } return true; } return false; } Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) app.$mount()