main.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * @Author : yuanrunwei
  3. * @Date : 2020-05-18 12:05:37
  4. * @LastEditors : yuanrunwei
  5. * @LastEditTime : 2020-05-18 12:21:24
  6. * @FilePath : \ambre-admin-noob\src\main.js
  7. */
  8. import Vue from 'vue'
  9. import App from './App.vue'
  10. import store from './store'
  11. import router from './router'
  12. import api from './common/api/api'
  13. import ElementUI from 'element-ui'
  14. import AFTableColumn from 'af-table-column'
  15. import utils from './common/utils/utils'
  16. import Cookies from 'js-cookie'
  17. import VueCropper from 'vue-cropper'
  18. import vNav from './components/vNav/vNav'
  19. import vTable from './components/vTable/vTable'
  20. import vInput from './components/vInput/vInput'
  21. import vPager from './components/vPager/vPager'
  22. import vAbove from './components/vAbove/vAbove'
  23. import vBread from './components/vBread/vBread'
  24. import cookiesDeploy from './common/utils/cookiesDeploy'
  25. import VueI18n from 'vue-i18n'
  26. import enLocale from 'element-ui/lib/locale/lang/en'
  27. import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
  28. import en from '@/lang/en'
  29. import zh from '@/lang/zh'
  30. import './common/sass/common.scss'
  31. import './common/font/iconfont.css'
  32. // import './permission.js'
  33. import 'babel-polyfill'
  34. import cssVars from 'css-vars-ponyfill'
  35. Vue.use(VueI18n)
  36. const i18n = new VueI18n({
  37. locale: localStorage.getItem('inter') || 'zh',
  38. messages: {
  39. en: {
  40. ...en,
  41. ...enLocale
  42. },
  43. zh: {
  44. ...zh,
  45. ...zhLocale
  46. }
  47. }
  48. })
  49. Vue.use(ElementUI, {
  50. i18n: (key, value) => i18n.t(key, value)
  51. })
  52. Vue.prototype.$th = (key1, key) => {
  53. return i18n.t(key1 ? key1 + key : key)
  54. }
  55. cssVars({})
  56. Vue.use(ElementUI)
  57. Vue.use(AFTableColumn)
  58. Vue.use(VueCropper)
  59. Vue.use(Cookies)
  60. Vue.use(vTable)
  61. Vue.use(vInput)
  62. Vue.use(vPager)
  63. Vue.use(vAbove)
  64. Vue.use(vBread)
  65. Vue.use(vNav)
  66. Vue.prototype.Cookies = Cookies
  67. Vue.prototype.$cookies = cookiesDeploy
  68. Vue.prototype.$auth = cookiesDeploy.getCookies()
  69. Vue.prototype.$api = api
  70. Vue.prototype.$utils = utils
  71. Vue.prototype.$storeId = parseInt(localStorage.getItem('storeId')) || ''
  72. Vue.prototype.$img = process.env.VUE_APP_IMG
  73. Vue.prototype.$url = process.env.VUE_APP_API
  74. Vue.config.productionTip = false
  75. window.alert = function (str) {
  76. let message
  77. switch (str) {
  78. case '插入图片错误':
  79. message = '插入图片失败,请重新上传图片'
  80. break
  81. default:
  82. message = str
  83. break
  84. }
  85. ElementUI.Message({
  86. type: 'error',
  87. message
  88. })
  89. }
  90. export default new Vue({
  91. router,
  92. store,
  93. i18n,
  94. render: h => h(App)
  95. }).$mount('#app')