Ohm-Management - Projektarbeit B-ME
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.

bootable.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _vue = require('vue');
  6. var _vue2 = _interopRequireDefault(_vue);
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. /**
  9. * Bootable
  10. * @mixin
  11. *
  12. * Used to add lazy content functionality to components
  13. * Looks for change in "isActive" to automatically boot
  14. * Otherwise can be set manually
  15. */
  16. /* @vue/component */
  17. exports.default = _vue2.default.extend().extend({
  18. name: 'bootable',
  19. props: {
  20. lazy: Boolean
  21. },
  22. data: function data() {
  23. return {
  24. isBooted: false
  25. };
  26. },
  27. computed: {
  28. hasContent: function hasContent() {
  29. return this.isBooted || !this.lazy || this.isActive;
  30. }
  31. },
  32. watch: {
  33. isActive: function isActive() {
  34. this.isBooted = true;
  35. }
  36. },
  37. methods: {
  38. showLazyContent: function showLazyContent(content) {
  39. return this.hasContent ? content : undefined;
  40. }
  41. }
  42. });
  43. //# sourceMappingURL=bootable.js.map