| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import Vue from 'vue'
- import App from './App'
- //商城 begin
- import Server from './utils/server'
- import Storage from './utils/storage'
- import ApiEx from './utils/api'
- import Mixin from './utils/mixin'
- import Global from './utils/global'
- import Auth from './utils/auth'
- import Cache from './utils/cache'
- import Util from './utils/util2'
- import Dialog from './utils/dialog'
- import Filter from './utils/filter'
- import Mpi from './utils/mpi'
- //商城 end
- //uview
- import uView from 'uview-ui';
- Vue.use(uView);
- Vue.config.productionTip = false
- App.mpType = 'app'
- //封装判空函数
- 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;
- }
- // 商城 begin
- // 设置服务器
- Global.server = Server
- // 版本
- Cache.preKey = Server.version
- // 全局注入
- Vue.mixin(Mixin)
- // 全局筛选器
- Object.keys(Filter).forEach(key => {
- Vue.filter(key, Filter[key])
- })
- // 全局属性 接口
- Vue.prototype.$api = Object.assign({}, ApiEx)
- // 全局属性 全局变量
- Vue.prototype.$global = Global
- // 全局缓存
- Vue.prototype.$storage = Storage
- // 同意授权
- Vue.prototype.$auth = Auth
- // 全局属性 工具函数
- Vue.prototype.$util = Util
- // 微信函数封装
- Vue.prototype.$mpi = Mpi
- // 全局属性 对话框函数
- Dialog.config = Object.assign(Dialog.config,{
- cancelColor:'#333',
- confirmColor:'#333',
- title:'温馨提示'
- })
- Vue.prototype.$dialog = Dialog
- // 商城 end
- const app = new Vue({
- ...App
- })
- app.$mount()
|