import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
// ui以及主题样式
import Element from "element-ui";
import "./assets/css/globelcolor.scss";
import "./assets/css/reset.scss";
import "./assets/css/company.scss";
// 请求方法
import { getTokens } from "@/api/api.js";
import { seveCookie } from "@/utils/getToken.js";

//复制粘贴插件
import VueClipboard from "vue-clipboard2";

// 使用bus进行通信
// import VueBus from "vue-bus";

//
import Router from "vue-router";

//图片截取插件
import VueCropper from "vue-cropper";

Vue.use(VueCropper);

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

getTokens().then(res => {
    //存储token
    seveCookie("token", res.data.data.token);
});
Vue.use(Element);
// Vue.use(VueBus);
Vue.use(VueClipboard);
Vue.config.productionTip = false;
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount("#app");