zoukankan      html  css  js  c++  java
  • xiaota-main

    // 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 App from './App'
    import router from './router'
    import store from './store'
    import Axios from 'axios'
    import $ from 'jquery'
    import HttpRequest from '@/common/js/axios'
    Vue.config.productionTip = false
    Vue.prototype.$http = HttpRequest;

    // 引入element
    import ElementUI from 'element-ui'
    Vue.use(ElementUI)

    // 引入全局函数
    import global from './global'
    Vue.use(global);
    // 
    import VueClipboard from 'vue-clipboard2'
    Vue.use(VueClipboard)
    // 懒加载
    import VueLazyload from 'vue-lazyload'
    Vue.use(VueLazyload)
    function getCookieItem(key){
        var arr = document.cookie.split("; ");
        for(var i = 0; i<arr.length; i++) {
            var res = arr[i].split("=");
            if (res[0] == key) {
                if(res.length==3){
                    return res[1]+'=';
                }else{
                    return res[1];
                }
            }
        }
    }
    // 登录
    router.beforeEach((to, from, next) => {
          const [directorAutoLogin,directorToken] = [getCookieItem('directorAutoLogin'),getCookieItem('directorToken')];
          if (!directorToken && to.path !== '/login') {
            next('/login');
          } else {
            next();
          }
          if(directorAutoLogin&&to.path === '/login'){
            next('/management');
          }
    })
    /* eslint-disable no-new */
    new Vue({
      el: '#app',
      router,
      store,
      $,
      components: { App },
      template: '<App/>'
    })
  • 相关阅读:
    Linux在高铁项目的部署环境
    【牛刀小试2】password保
    fcitx的安装_配置
    Mingw:在Linux系统下编译Windows的程序
    linux安装qwt插件linux
    qt超强绘图控件qwt
    WIN7 下 Qt Creator 安装 QWT
    QWT6.0.1+win7下安装说明
    qwt 介绍
    Linux中的svn客户端RabbitVCS-2
  • 原文地址:https://www.cnblogs.com/xiaoxiao95/p/12726586.html
Copyright © 2011-2022 走看看