| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- 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()
|