智慧水务管理系统 - 精河县供水工程综合管理平台

index.js 1.1KB

123456789101112131415161718192021222324
  1. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  2. require("../../_virtual/_rolldown/runtime.js");
  3. const require_error = require("../../utils/error.js");
  4. let lodash_unified = require("lodash-unified");
  5. let vue = require("vue");
  6. //#region ../../packages/hooks/use-attrs/index.ts
  7. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8. const LISTENER_PREFIX = /^on[A-Z]/;
  9. const useAttrs = (params = {}) => {
  10. const { excludeListeners = false, excludeKeys } = params;
  11. const allExcludeKeys = (0, vue.computed)(() => {
  12. return (excludeKeys?.value || []).concat(DEFAULT_EXCLUDE_KEYS);
  13. });
  14. const instance = (0, vue.getCurrentInstance)();
  15. if (!instance) {
  16. require_error.debugWarn("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function");
  17. return (0, vue.computed)(() => ({}));
  18. }
  19. return (0, vue.computed)(() => (0, lodash_unified.fromPairs)(Object.entries(instance.proxy?.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key)))));
  20. };
  21. //#endregion
  22. exports.useAttrs = useAttrs;
  23. //# sourceMappingURL=index.js.map