main.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import App from './App';
  2. import messages from './locale/index';
  3. // 全局mixins,用于实现setData等功能,请勿删除!';
  4. import zpMixins from '@/uni_modules/zp-mixins/index.js';
  5. const systemInfo = uni.getSystemInfoSync().appLanguage
  6. const localLang = systemInfo === 'zh-Hans' ? "zh" : "en"
  7. let i18nConfig = {
  8. locale: localLang,
  9. messages
  10. }
  11. // #ifndef VUE3
  12. import Vue from 'vue';
  13. Vue.use(zpMixins);
  14. // 导入p-f-unicom
  15. import unicom from '@/uni_modules/p-f-unicom/index.js';
  16. // 用于解决组件间关系(目前受制于平台及写法,仍可能存在小部分场景不生效,需手动调试修复或『替换对应组件』)
  17. Vue.use(unicom, {
  18. name: 'unicom',
  19. idName: 'unicomId',
  20. groupName: 'unicomGroup'
  21. });
  22. import VueI18n from 'vue-i18n'
  23. Vue.use(VueI18n)
  24. const i18n = new VueI18n(i18nConfig)
  25. Vue.config.productionTip = false;
  26. App.mpType = 'app';
  27. const app = new Vue({
  28. i18n,
  29. ...App
  30. });
  31. app.$mount();
  32. // #endif
  33. // #ifdef VUE3
  34. import { createSSRApp } from 'vue';
  35. import { createI18n } from 'vue-i18n'
  36. const i18n = createI18n(i18nConfig)
  37. export function createApp() {
  38. const app = createSSRApp(App);
  39. app.use(i18n)
  40. app.mixin(zpMixins);
  41. return {
  42. app
  43. };
  44. }
  45. // #endif