main.js 1.0 KB

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