// 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 ElementUI from 'element-ui' //引入js import 'element-ui/lib/theme-chalk/index.css' //引入css import echarts from 'echarts' Vue.config.productionTip = false Vue.prototype.$echarts = echarts import moment from "moment" Vue.prototype.moment = moment //引入公共方法 // import common from '../static/JS/common.js' // Vue.prototype.$common = common import './assets/css/common.css' import './util/interface' import nozzle from "./util/interface" Vue.prototype.nozzle = nozzle import { http } from "./api/APIindex" Vue.prototype.$http = http Vue.use(ElementUI) import Viewer from 'v-viewer' Vue.use(Viewer) Viewer.setDefaults({ zIndexInline: 9999 }) /** 权限指令,对按钮权限的控制 **/ Vue.directive('has', { inserted: function(el, binding) { if (!Vue.prototype.$_has(binding.value)) { el.parentNode.removeChild(el) } } }) // 权限检查方法(且把该方法添加到vue原型中) Vue.prototype.$_has = function(value) { let isExist = false // 从浏览器缓存中获取权限数组(该数组在登入成功后拉取用户的权限信息时保存在浏览器的缓存中) var buttonpermsStr = sessionStorage.getItem('powerHandle') if (buttonpermsStr === undefined || buttonpermsStr == null) { return false } if (buttonpermsStr.indexOf(value) >= 0) { // 若在按钮中定义的权限字段能在后端返回的权限数组中能找到,则该按钮可显示 isExist = true } return isExist } /* eslint-disable no-new */ const vue = new Vue({ el: '#app', router, components: { App }, template: '<App/>' }) // window.addEventListener('load', function () { // vue.$router.replace('/index') // 列表页面的路由 // })