You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import App from "./App";
  2. import * as utils from "@/utils/utils";
  3. import store from "./stores";
  4. import {
  5. fileURL
  6. } from "@/datas/fileURL.js";
  7. //Vue2 内容
  8. // #ifndef VUE3
  9. import Vue from "vue";
  10. import uView from "uview-ui";
  11. Vue.use(uView);
  12. Vue.use(store);
  13. Vue.config.productionTip = false;
  14. App.mpType = "app";
  15. Vue.prototype.$util = utils;
  16. const app = new Vue({
  17. ...App,
  18. });
  19. app.$mount();
  20. // #endif
  21. //Vue3 内容
  22. // #ifdef VUE3
  23. import {
  24. createSSRApp
  25. } from "vue";
  26. import uView from "./uni_modules/vk-uview-ui";
  27. // import request from '@/utils/network/request.js';
  28. import {
  29. useCounterStore
  30. } from "@/stores/counter";
  31. export function createApp() {
  32. const app = createSSRApp(App);
  33. app.use(store);
  34. app.use(uView);
  35. //系统属性全局注册
  36. const counter = useCounterStore();
  37. app.config.globalProperties.$systemInfo = counter.systemInfo;
  38. app.config.globalProperties.$util = utils;
  39. app.config.globalProperties.$imgUrl = fileURL + "/image/";
  40. //全局网络注册
  41. // app.config.globalProperties.$request = request
  42. return {
  43. app,
  44. //Pinia, // 此处必须将 Pinia 返回
  45. };
  46. }
  47. // #endif