@@ -586,6 +586,7 @@ function processSlotContent (el) {
586586 const slotTarget = getBindingAttr ( el , 'slot' )
587587 if ( slotTarget ) {
588588 el . slotTarget = slotTarget === '""' ? '"default"' : slotTarget
589+ el . slotTargetDynamic = ! ! ( el . attrsMap [ ':slot' ] || el . attrsMap [ 'v-bind:slot' ] )
589590 // preserve slot as an attribute for native shadow DOM compat
590591 // only for non-scoped slots.
591592 if ( el . tag !== 'template' && ! el . slotScope ) {
@@ -607,8 +608,10 @@ function processSlotContent (el) {
607608 )
608609 }
609610 }
610- el . slotTarget = getSlotName ( slotBinding )
611- el . slotScope = slotBinding . value
611+ const { name, dynamic } = getSlotName ( slotBinding )
612+ el . slotTarget = name
613+ el . slotTargetDynamic = dynamic
614+ el . slotScope = slotBinding . value || `_` // force it into a scoped slot for perf
612615 }
613616 } else {
614617 // v-slot on component, denotes default slot
@@ -637,10 +640,11 @@ function processSlotContent (el) {
637640 }
638641 // add the component's children to its default slot
639642 const slots = el . scopedSlots || ( el . scopedSlots = { } )
640- const target = getSlotName ( slotBinding )
641- const slotContainer = slots [ target ] = createASTElement ( 'template' , [ ] , el )
643+ const { name, dynamic } = getSlotName ( slotBinding )
644+ const slotContainer = slots [ name ] = createASTElement ( 'template' , [ ] , el )
645+ slotContainer . slotTargetDynamic = dynamic
642646 slotContainer . children = el . children
643- slotContainer . slotScope = slotBinding . value
647+ slotContainer . slotScope = slotBinding . value || `_`
644648 // remove children as they are returned from scopedSlots now
645649 el . children = [ ]
646650 // mark el non-plain so data gets generated
@@ -664,9 +668,9 @@ function getSlotName (binding) {
664668 }
665669 return dynamicKeyRE . test ( name )
666670 // dynamic [name]
667- ? name . slice ( 1 , - 1 )
671+ ? { name : name . slice ( 1 , - 1 ) , dynamic : true }
668672 // static name
669- : `"${ name } "`
673+ : { name : `"${ name } "` , dynamic : false }
670674}
671675
672676// handle <slot/> outlets
0 commit comments