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

fix #2535
This commit is contained in:
Evan You 2020-11-27 14:35:38 -05:00
parent 6e46a574ed
commit 2ab8c41a1a

View File

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