main.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import App from "./App";
  2. // #ifndef VUE3
  3. import Vue from "vue";
  4. import "./uni.promisify.adaptor";
  5. import uView from "@/uview-ui";
  6. import VueI18n from "vue-i18n";
  7. import messages from "./commont/messages.js";
  8. // import uView from '/uview-ui/uview-ui'
  9. Vue.use(VueI18n);
  10. Vue.config.productionTip = false;
  11. // 多国语言包配置
  12. const i18n = new VueI18n({
  13. locale: uni.getStorageSync("language") || "zh-CN",
  14. // locale: "en-US",
  15. messages,
  16. });
  17. Vue.prototype._language = uni.getStorageSync("language") || "zh-CN";
  18. Vue.prototype._i18n = i18n;
  19. Vue.use(uView);
  20. App.mpType = "app";
  21. const app = new Vue({
  22. i18n,
  23. ...App,
  24. });
  25. // import WebIM from "./utils/WebIM.js"
  26. // Vue.use(WebIM,app)
  27. // 引入请求封装,将app参数传递到配置中
  28. // require('./commont/http.interceptor.js')(app)
  29. import httpInterceptor from "@/commont/http.interceptor.js";
  30. // 这里需要写在最后,是为了等Vue创建对象完成,引入"app"对象(也即页面的"this"实例)
  31. Vue.use(httpInterceptor, app);
  32. app.$mount();
  33. // #endif
  34. // #ifdef VUE3
  35. import { createSSRApp } from "vue";
  36. export function createApp() {
  37. const app = createSSRApp(App);
  38. return {
  39. app,
  40. };
  41. }
  42. // #endif