main.js 891 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from './store' // store
  4. import plugins from './plugins' // plugins
  5. import './permission' // permission
  6. import config from '@/config'
  7. Vue.use(plugins)
  8. Vue.config.productionTip = false
  9. Vue.prototype.$store = store
  10. App.mpType = 'app'
  11. // 挂载全局图片地址
  12. Vue.prototype.$HTTP = config.baseUrl
  13. // 图片使用网络地址
  14. Vue.prototype.loadImgSrc = function(img) {
  15. //项目的地址域名,例如百度
  16. return config.baseIconUrl+img;
  17. }
  18. Vue.prototype.encodify = function(data){
  19. return encodeURIComponent(JSON.stringify(data))
  20. }
  21. Vue.prototype.decodify = function(data){
  22. return JSON.parse(decodeURIComponent(data))
  23. }
  24. //本地上传图片前缀地址
  25. Vue.prototype.loadImgSrcLocalhost = function(img) {
  26. //项目的地址域名,例如百度
  27. return config.baseUrl+img;
  28. }
  29. const app = new Vue({
  30. ...App
  31. })
  32. app.$mount()