import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import  Erpindex from '../utils/erpindex'
import axios from 'axios'
import 'vue-easytable/libs/themes-base/index.css'
import {VTable,VPagination} from 'vue-easytable'
import 'viewerjs/dist/viewer.css'
import Viewer from 'v-viewer' //权限编码JS

Vue.http = Vue.prototype.$http = axios

// 时间扩展格式化
Date.prototype.Format = function (fmt) {
  var o = {
    "M+": this.getMonth() + 1, //月份
    "d+": this.getDate(), //日
    "h+": this.getHours(), //小时
    "m+": this.getMinutes(), //分
    "s+": this.getSeconds() //秒
  };
  if (/(y+)/.test(fmt)){ //根据y的长度来截取年
    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  }
  for (var k in o){
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  }
  return fmt;
};
Vue.use(ElementUI)
Vue.use(Erpindex)
Vue.use(Viewer);
Vue.component(VTable.name, VTable)
Vue.component(VPagination.name, VPagination)

Vue.prototype.$axios = axios
