index.js 756 B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  5. const useForwardRef = (forwardRef) => {
  6. const setForwardRef = (el) => {
  7. forwardRef.value = el;
  8. };
  9. vue.provide(FORWARD_REF_INJECTION_KEY, {
  10. setForwardRef
  11. });
  12. };
  13. const useForwardRefDirective = (setForwardRef) => {
  14. return {
  15. mounted(el) {
  16. setForwardRef(el);
  17. },
  18. updated(el) {
  19. setForwardRef(el);
  20. },
  21. unmounted() {
  22. setForwardRef(null);
  23. }
  24. };
  25. };
  26. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  27. exports.useForwardRef = useForwardRef;
  28. exports.useForwardRefDirective = useForwardRefDirective;
  29. //# sourceMappingURL=index.js.map