项目原始demo,不改动
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.
 
 
 
 

51 lignes
891 B

  1. // Utilities
  2. import { removed } from '../../util/console'; // Types
  3. import Vue from 'vue';
  4. /**
  5. * Bootable
  6. * @mixin
  7. *
  8. * Used to add lazy content functionality to components
  9. * Looks for change in "isActive" to automatically boot
  10. * Otherwise can be set manually
  11. */
  12. /* @vue/component */
  13. export default Vue.extend().extend({
  14. name: 'bootable',
  15. props: {
  16. eager: Boolean
  17. },
  18. data: () => ({
  19. isBooted: false
  20. }),
  21. computed: {
  22. hasContent() {
  23. return this.isBooted || this.eager || this.isActive;
  24. }
  25. },
  26. watch: {
  27. isActive() {
  28. this.isBooted = true;
  29. }
  30. },
  31. created() {
  32. /* istanbul ignore next */
  33. if ('lazy' in this.$attrs) {
  34. removed('lazy', this);
  35. }
  36. },
  37. methods: {
  38. showLazyContent(content) {
  39. return this.hasContent && content ? content() : [this.$createElement()];
  40. }
  41. }
  42. });
  43. //# sourceMappingURL=index.js.map