import Vue from 'vue' import App from './App' Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) import cuCustom from './lib/colorui/components/cu-custom.vue' Vue.component('cu-custom',cuCustom) document.body.addEventListener('touchstart', () => {}, { passive: false }) // 引入文件 import Dever from './lib/dever' // 绑定全局的组件 import ourLoading from '@/lib/our-loading/our-loading.vue' Vue.component('ourLoading', ourLoading) Vue.prototype.pageLoading = true; Vue.prototype.pageLoadingText = '加载中...'; // 绑定弹窗 import layer from '@/static/layer/layer.js'; Dever.layer = layer; // 绑定到 Vue 的实例上 Vue.prototype.Dever = Dever; // 载入全局配置 默认配置,防止第一次载入报错的,系统会自动从后台更新最新的配置 var defaultConfig = { 'system_name' : '合小记', 'system_info' : '合小记', 'system_logo' : '../../static/logo.png', //自动更新时间间隔 'set_update' : 86400, //本次更新时间 'update_time' : false, }; Vue.prototype.Dever.init('main/?l=api.config', Vue, defaultConfig); //自定义get的loading效果,设置全屏loading Vue.prototype.Dever.setGetLoading(function(self) { self.vue.prototype.pageLoading = true; }, function(self) { self.vue.prototype.pageLoading = false; self.btnFinish(); }); //自定义post的loading Vue.prototype.Dever.setPostLoading(function(self) { self.btnLoad(); uni.showLoading({title: '加载中', mask: true}); }, function(self) { self.btnFinish(); uni.hideLoading(); }); //自定义page的loading效果,设置全屏loading Vue.prototype.Dever.setPageLoading(function(self) { self.vue.prototype.pageLoading = true; }, function(self) { self.vue.prototype.pageLoading = false; self.btnFinish(); }); //设置switchTab Vue.prototype.Dever.switchTab = []; Vue.prototype.Dever.web_view = '/pages/tool/web_view'; //自定义switchTab页面回调,因为switchTab执行后不会自动刷新页面,这里需要做个回调 Vue.prototype.Dever.switchTabCall = { 'index/index' : function(self, e) { var page = self.getPage(); if (!page) return; if ('getInfo' in page) { page.getInfo(); } } }; //载入一些通用的方法 Vue.prototype.Dever.common({ // 载入人工客服 'callPhone' : function() { uni.makePhoneCall({ phoneNumber: Vue.prototype.$config.system_phone }); }, // 跳转到页面 'location' : function(e) { Vue.prototype.Dever.viewLocation(e); }, // 提示 'alert' : function(e) { Vue.prototype.Dever.viewAlert(e); }, }) app.$mount()