/* * @Author : yuanrunwei * @Date : 2020-05-18 12:05:37 * @LastEditors : yuanrunwei * @LastEditTime : 2020-05-18 12:21:24 * @FilePath : \ambre-admin-noob\src\main.js */ import Vue from 'vue' import App from './App.vue' import store from './store' import router from './router' import api from './common/api/api' import ElementUI from 'element-ui' import AFTableColumn from 'af-table-column' import utils from './common/utils/utils' import Cookies from 'js-cookie' import VueCropper from 'vue-cropper' import vNav from './components/vNav/vNav' import vTable from './components/vTable/vTable' import vInput from './components/vInput/vInput' import vPager from './components/vPager/vPager' import vAbove from './components/vAbove/vAbove' import vBread from './components/vBread/vBread' import cookiesDeploy from './common/utils/cookiesDeploy' import VueI18n from 'vue-i18n' import enLocale from 'element-ui/lib/locale/lang/en' import zhLocale from 'element-ui/lib/locale/lang/zh-CN' import en from '@/lang/en' import zh from '@/lang/zh' import './common/sass/common.scss' import './common/font/iconfont.css' // import './permission.js' import 'babel-polyfill' import cssVars from 'css-vars-ponyfill' Vue.use(VueI18n) const i18n = new VueI18n({ locale: localStorage.getItem('inter') || 'zh', messages: { en: { ...en, ...enLocale }, zh: { ...zh, ...zhLocale } } }) Vue.use(ElementUI, { i18n: (key, value) => i18n.t(key, value) }) Vue.prototype.$th = (key1, key) => { return i18n.t(key1 ? key1 + key : key) } cssVars({}) Vue.use(ElementUI) Vue.use(AFTableColumn) Vue.use(VueCropper) Vue.use(Cookies) Vue.use(vTable) Vue.use(vInput) Vue.use(vPager) Vue.use(vAbove) Vue.use(vBread) Vue.use(vNav) Vue.prototype.Cookies = Cookies Vue.prototype.$cookies = cookiesDeploy Vue.prototype.$auth = cookiesDeploy.getCookies() Vue.prototype.$api = api Vue.prototype.$utils = utils Vue.prototype.$storeId = parseInt(localStorage.getItem('storeId')) || '' Vue.prototype.$img = process.env.VUE_APP_IMG Vue.prototype.$url = process.env.VUE_APP_API Vue.config.productionTip = false window.alert = function (str) { let message switch (str) { case '插入图片错误': message = '插入图片失败,请重新上传图片' break default: message = str break } ElementUI.Message({ type: 'error', message }) } export default new Vue({ router, store, i18n, render: h => h(App) }).$mount('#app')