// 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 'babel-polyfill'; import App from './App' import router from './router' import VueWechatTitle from 'vue-wechat-title' import VueTouch from 'vue-touch' import VueClipboard from 'vue-clipboard2' // 导入全局变量模块 import _global from './components/utils/Global' Vue.prototype.GLOBAL = _global //倒入全局weui import 'weui' import weui from 'weui.js' Vue.prototype.$weui = weui; require('es6-promise').polyfill(); Vue.config.productionTip = false Vue.use(VueWechatTitle) Vue.use(VueTouch) Vue.use(VueClipboard) Vue.use(VueLazyload, { error: '',//这个是请求失败后显示的图片 loading: 'static/loading.gif',//这个是加载的loading过渡效果 try: 4 // 这个是加载图片数量 }) Vue.http.interceptors.push(function (request, next) {//拦截器 // 跨域携带cookie request.credentials = true; request.crossDomain = true; // request.Cookies = document.cookie; next() }) Vue.http.headers = {'Content-Type': 'application/x-www-form-urlencoded'} Vue.http.options.xhr = {withCredentials: true} Vue.http.options.emulateJSON = true //判断是否登录 let cookieobj = document.cookie; let Cookies = {}; cookieobj.split(';').forEach(l => { var parts = l.split('='); Cookies[parts[0].trim()] = (parts[1] || '').trim(); }); let islogin = false; let site_uid = Cookies['site_uid']; let openid = 'openid_' + site_uid; if (Cookies[openid] && Cookies['site_uid']) { islogin = true; } window.islogin = islogin; /* eslint-disable no-new */ new Vue({ el: '#app', router, components: {App}, template: '', mounted: function () { } });