Jelajahi Sumber

fix(slots): dynamically named slots should be keyed by name

fix #2535
Evan You 5 tahun lalu
induk
melakukan
2ab8c41a1a
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      packages/runtime-core/src/helpers/renderSlot.ts

+ 1 - 1
packages/runtime-core/src/helpers/renderSlot.ts

@@ -47,7 +47,7 @@ export function renderSlot(
   const validSlotContent = slot && ensureValidVNode(slot(props))
   const rendered = createBlock(
     Fragment,
-    { key: props.key },
+    { key: props.key || `_${name}` },
     validSlotContent || (fallback ? fallback() : []),
     validSlotContent && (slots as RawSlots)._ === SlotFlags.STABLE
       ? PatchFlags.STABLE_FRAGMENT