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 850B

12345678910111213141516171819202122232425262728293031323334353637
  1. import Vue from 'vue';
  2. /**
  3. * Bootable
  4. * @mixin
  5. *
  6. * Used to add lazy content functionality to components
  7. * Looks for change in "isActive" to automatically boot
  8. * Otherwise can be set manually
  9. */
  10. /* @vue/component */
  11. export default Vue.extend().extend({
  12. name: 'bootable',
  13. props: {
  14. lazy: Boolean
  15. },
  16. data: function data() {
  17. return {
  18. isBooted: false
  19. };
  20. },
  21. computed: {
  22. hasContent: function hasContent() {
  23. return this.isBooted || !this.lazy || this.isActive;
  24. }
  25. },
  26. watch: {
  27. isActive: function isActive() {
  28. this.isBooted = true;
  29. }
  30. },
  31. methods: {
  32. showLazyContent: function showLazyContent(content) {
  33. return this.hasContent ? content : undefined;
  34. }
  35. }
  36. });
  37. //# sourceMappingURL=bootable.js.map