index.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import tab from "./tab.plugins";
  2. import auth from "./auth.plugins";
  3. import modal from "./modal.plugins";
  4. import common from "./common.plugins";
  5. import setting from "./setting.plugins";
  6. import time from "./time.plugins.js";
  7. import constData from "./constData.plugins.js";
  8. import nfc from "./nfc.plugins.js";
  9. import keyListen from "./keyListen.plugins.js";
  10. import permission from "./permission.plugins.js";
  11. import config from "@/config"; // config
  12. import { useDict } from '@/utils/dict'
  13. import { settingStores } from "@/store/modules/index";
  14. import dayjs from 'dayjs'
  15. import isBetween from 'dayjs/plugin/isBetween';
  16. import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
  17. import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
  18. dayjs.extend(isBetween);
  19. dayjs.extend(isSameOrAfter)
  20. dayjs.extend(isSameOrBefore)
  21. export default {
  22. install(app) {
  23. // 公共请求路径
  24. app.provide("$BASE_URL", config.baseUrl);
  25. app.config.globalProperties.$BASE_URL = config.baseUrl;
  26. // 公共website路径
  27. app.provide("$websiteUrl", config.websiteUrl);
  28. app.config.globalProperties.$websiteUrl = config.websiteUrl;
  29. // 页签操作
  30. app.provide("$tab", tab);
  31. app.config.globalProperties.$tab = tab;
  32. // 认证对象
  33. app.provide("$auth", auth);
  34. app.config.globalProperties.$auth = auth;
  35. // 模态框对象
  36. app.provide("$modal", modal);
  37. app.config.globalProperties.$modal = modal;
  38. // 数据处理
  39. app.provide("$common", common);
  40. app.config.globalProperties.$common = common;
  41. // 公共设置方法
  42. app.provide("$setting", setting);
  43. app.config.globalProperties.$setting = setting;
  44. // 公共时间处理方法
  45. app.provide("$time", time);
  46. app.config.globalProperties.$time = time;
  47. // 公共默认数据存储
  48. app.provide("$constData", constData);
  49. app.config.globalProperties.$constData = constData;
  50. // 公共NFC
  51. app.provide("$nfc", nfc);
  52. app.config.globalProperties.$nfc = nfc;
  53. // 公共设置stroe
  54. app.provide("$settingStore", settingStores());
  55. app.config.globalProperties.$settingStore = settingStores();
  56. // 公共时间处理方法dayjs
  57. app.provide("$dayjs", dayjs);
  58. app.config.globalProperties.$dayjs = dayjs;
  59. // 公共字典模块
  60. app.config.globalProperties.useDict = useDict
  61. // 公共物理按钮监听
  62. app.provide("$keyListen", keyListen);
  63. app.config.globalProperties.$keyListen = keyListen;
  64. // App权限判断
  65. app.provide("$permission", permission);
  66. app.config.globalProperties.$permission = permission;
  67. },
  68. };