slotFlags.ts 980 B

123456789101112131415161718192021222324252627282930
  1. export const enum SlotFlags {
  2. /**
  3. * Stable slots that only reference slot props or context state. The slot
  4. * can fully capture its own dependencies so when passed down the parent won't
  5. * need to force the child to update.
  6. */
  7. STABLE = 1,
  8. /**
  9. * Slots that reference scope variables (v-for or an outer slot prop), or
  10. * has conditional structure (v-if, v-for). The parent will need to force
  11. * the child to update because the slot does not fully capture its dependencies.
  12. */
  13. DYNAMIC = 2,
  14. /**
  15. * `<slot/>` being forwarded into a child component. Whether the parent needs
  16. * to update the child is dependent on what kind of slots the parent itself
  17. * received. This has to be refined at runtime, when the child's vnode
  18. * is being created (in `normalizeChildren`)
  19. */
  20. FORWARDED = 3
  21. }
  22. /**
  23. * Dev only
  24. */
  25. export const slotFlagsText = {
  26. [SlotFlags.STABLE]: 'STABLE',
  27. [SlotFlags.DYNAMIC]: 'DYNAMIC',
  28. [SlotFlags.FORWARDED]: 'FORWARDED'
  29. }