main.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import '.env.js'
  2. import App from './App'
  3. //引入语言包
  4. import messages from './locale/index'
  5. console.log(messages)
  6. let i18nConfig = {
  7. locale: uni.getLocale(),
  8. messages
  9. }
  10. //引入前置路由颜值
  11. import {
  12. router,
  13. RouterMount
  14. } from './common/router/router.js' //路径换成自己的
  15. Vue.use(router)
  16. // #ifndef VUE3
  17. import Vue from 'vue'
  18. import store from './store'
  19. import Nav from './components/en-utils/en-nav/en-nav.vue'
  20. import VueI18n from 'vue-i18n'
  21. Vue.use(VueI18n)
  22. const i18n = new VueI18n(i18nConfig)
  23. Vue.component('Nav', Nav)
  24. Vue.config.productionTip = false
  25. App.mpType = 'app'
  26. const app = new Vue({
  27. i18n,
  28. ...App,
  29. store
  30. })
  31. // app.$mount()
  32. // #ifdef H5
  33. RouterMount(app, router, '#app')
  34. // #endif
  35. // #ifndef H5
  36. app.$mount(); //为了兼容小程序及app端必须这样写才有效果
  37. // #endif
  38. // #endif
  39. // #ifdef VUE3
  40. import {
  41. createSSRApp
  42. } from 'vue'
  43. import { createI18n } from 'vue-i18n'
  44. const i18n = createI18n(i18nConfig)
  45. export function createApp() {
  46. const app = createSSRApp(App)
  47. app.use(i18n)
  48. return {
  49. app,
  50. }
  51. }
  52. // #endif