main.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import {
  4. gotoPage,
  5. playMusic,
  6. openUrl,
  7. } from './common/util.js'
  8. import {
  9. getSycCache
  10. } from './config/cache'
  11. import {
  12. baseUrl
  13. } from './config/setting'
  14. Vue.config.productionTip = false
  15. Vue.prototype.$request = request
  16. Vue.prototype.gotoPage = gotoPage
  17. Vue.prototype.playMusic = playMusic
  18. Vue.prototype.openUrl = openUrl
  19. Vue.prototype.baseUrl = baseUrl
  20. import request from './config/request.js'
  21. // 引入全局uView2.0
  22. import uView from 'uview-ui'
  23. Vue.use(uView);
  24. // 如此配置即可
  25. uni.$u.config.unit = 'rpx'
  26. import VueClipboard from 'vue-clipboard2' //引入插件
  27. Vue.use(VueClipboard) //安装插件
  28. // i18n部分的配置
  29. // 引入语言包,注意路径
  30. import Chinese from '@/common/locales/zh-cn.js';
  31. // 英语
  32. import English from '@/common/locales/en.js';
  33. // 日语
  34. import Japanese from '@/common/locales/jap.js';
  35. // 马来西亚
  36. import Malaysia from '@/common/locales/mal.js';
  37. // 印度尼西亚
  38. import Indonesia from '@/common/locales/ind.js';
  39. // 泰语
  40. import Thailand from '@/common/locales/tha.js';
  41. // 越南语
  42. import Vietnam from '@/common/locales/vie.js';
  43. // 韩语
  44. import SouthKorea from '@/common/locales/sk.js';
  45. // 香港
  46. import HongKong from '@/common/locales/hk.js';
  47. // 法语
  48. import French from '@/common/locales/fr.js';
  49. // VueI18n
  50. import VueI18n from 'vue-i18n'
  51. Vue.use(VueI18n);
  52. const lang = getSycCache('lang')
  53. const langs = {
  54. 'zh-cn': Chinese,
  55. 'en': English,
  56. 'jap': Japanese,
  57. 'mal': Malaysia,
  58. 'ind': Indonesia,
  59. 'tha': Thailand,
  60. 'vie': Vietnam,
  61. 'sk': SouthKorea,
  62. }
  63. Vue.prototype.langs = langs
  64. const i18n = new VueI18n({
  65. // 默认语言
  66. locale: lang ? lang : 'zh-cn',
  67. // 引入语言文件
  68. messages: langs,
  69. fallbackLocale: 'zh-cn',
  70. });
  71. Vue.prototype._i18n = i18n
  72. // window.Languages = i18n;
  73. // VueI18n
  74. App.mpType = 'app'
  75. const app = new Vue({
  76. ...App,
  77. i18n
  78. })
  79. app.$mount()