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.

42 lines
1.0 KiB

1 month ago
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var shared = require('@vue/shared');
  4. const withInstall = (main, extra) => {
  5. main.install = (app) => {
  6. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7. app.component(comp.name, comp);
  8. }
  9. };
  10. if (extra) {
  11. for (const [key, comp] of Object.entries(extra)) {
  12. main[key] = comp;
  13. }
  14. }
  15. return main;
  16. };
  17. const withInstallFunction = (fn, name) => {
  18. fn.install = (app) => {
  19. fn._context = app._context;
  20. app.config.globalProperties[name] = fn;
  21. };
  22. return fn;
  23. };
  24. const withInstallDirective = (directive, name) => {
  25. directive.install = (app) => {
  26. app.directive(name, directive);
  27. };
  28. return directive;
  29. };
  30. const withNoopInstall = (component) => {
  31. component.install = shared.NOOP;
  32. return component;
  33. };
  34. exports.withInstall = withInstall;
  35. exports.withInstallDirective = withInstallDirective;
  36. exports.withInstallFunction = withInstallFunction;
  37. exports.withNoopInstall = withNoopInstall;
  38. //# sourceMappingURL=install.js.map