install.js 1.1 KB

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