// The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue'; import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; import App from './App'; // 引入路由 import router from './router'; // 引入状态管理 import store from './vuex/store'; // 引入icon // import './assets/icon/iconfont.css' import touch from 'vue-directive-touch'; import axios from 'axios'; Vue.prototype.$axios = axios; Vue.config.productionTip = false; // 文件上传域名 // Vue.prototype.$imgUrl = "http://blue.cn1.utools.club/api1/file/uploadOne Vue.use(ElementUI); Vue.use(touch); // 创建loading Vue.prototype.openLoading = function() { const loading = this.$loading({ // 声明一个loading对象 lock: true, // 是否锁屏 text: '正在加载...', // 加载动画的文字 spinner: 'el-icon-loading', // 引入的loading图标 background: 'rgba(0, 0, 0, 0.7)', // 背景颜色 // target: '.main', // 需要遮罩的区域 body: true, // customClass: 'mask' // 遮罩层新增类名 }) setTimeout(function () { // 设定定时器,超时5S后自动关闭遮罩层,避免请求失败时,遮罩层一直存在的问题 loading.close(); // 关闭遮罩层 },500) return loading; } /* eslint-disable no-new */ new Vue({ el: '#app', router, store, //使用store vuex状态管理 components: { App }, template: '', })