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.

2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. // main.ts
  41. app.directive('preventReClick', (el, binding) => {
  42. function preventReClickFun(elValue, bindingValue) {
  43. if (!elValue.disabled) {
  44. elValue.disabled = true
  45. setTimeout(() => {
  46. elValue.disabled = false
  47. }, bindingValue.value || 3000)
  48. }
  49. }
  50. el.addEventListener('click', () => preventReClickFun(el, binding))
  51. binding.dir.unmounted = function() {
  52. el.removeEventListener('click', () => preventReClickFun(el, binding))
  53. }
  54. });
  55. //全局网络注册
  56. // app.config.globalProperties.$request = request
  57. return {
  58. app,
  59. //Pinia, // 此处必须将 Pinia 返回
  60. };
  61. }
  62. // #endif