main.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import App from "./App";
  2. // main.js
  3. import uView from "uview-ui";
  4. import api from "@/libs/http/index.js";
  5. Vue.prototype.api = api; //(2)
  6. Vue.use(uView);
  7. import { throttle } from "@/libs/util/utils.js"; //防抖
  8. Vue.directive("throttle", throttle);
  9. // #ifndef VUE3
  10. import Vue from "vue";
  11. import { broadcastScan } from "@/utils/scanCode";
  12. // main.js
  13. // import "amfe-flexible";
  14. Vue.prototype.apiServer = "http://192.168.1.45/dev-api";
  15. Vue.prototype.$broadcastScan = broadcastScan;
  16. Vue.prototype.ip = "192.168.1.45";
  17. Vue.config.productionTip = false;
  18. App.mpType = "app";
  19. uni.setStorage({
  20. key: "storage_token",
  21. data: "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdjZWVjNGI2LWE2NGYtNDI3OS05MWEzLTAxMzdkNmEyNDdkNiJ9.7e2lVcZ0b3Y8ofwDCvrETpEZQETrp1Ik-MYfsufiMSoR7oqvI5XiXgbe2bVk4jOJGt7ns0ryKbp5XXE71hoXcA",
  22. success: function () {
  23. console.log("success");
  24. },
  25. });
  26. const app = new Vue({
  27. ...App,
  28. });
  29. app.$mount();
  30. // #endif
  31. // #ifdef VUE3
  32. import { createSSRApp } from "vue";
  33. export function createApp() {
  34. const app = createSSRApp(App);
  35. return {
  36. app,
  37. };
  38. }
  39. // #endif