@@ -135,7 +135,7 @@ export function buildSlots(
|
||||
let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0
|
||||
// with `prefixIdentifiers: true`, this can be further optimized to make
|
||||
// it dynamic only when the slot actually uses the scope variables.
|
||||
if (!__BROWSER__ && context.prefixIdentifiers) {
|
||||
if (!__BROWSER__ && !context.ssr && context.prefixIdentifiers) {
|
||||
hasDynamicSlots = hasScopeRef(node, context.identifiers)
|
||||
}
|
||||
|
||||
@@ -144,6 +144,9 @@ export function buildSlots(
|
||||
const onComponentSlot = findDir(node, 'slot', true)
|
||||
if (onComponentSlot) {
|
||||
const { arg, exp } = onComponentSlot
|
||||
if (arg && !isStaticExp(arg)) {
|
||||
hasDynamicSlots = true
|
||||
}
|
||||
slotsProperties.push(
|
||||
createObjectProperty(
|
||||
arg || createSimpleExpression('default', true),
|
||||
@@ -317,7 +320,12 @@ export function buildSlots(
|
||||
|
||||
let slots = createObjectExpression(
|
||||
slotsProperties.concat(
|
||||
createObjectProperty(`_`, createSimpleExpression(`1`, false))
|
||||
createObjectProperty(
|
||||
`_`,
|
||||
// 2 = compiled but dynamic = can skip normalization, but must run diff
|
||||
// 1 = compiled and static = can skip normalization AND diff as optimized
|
||||
createSimpleExpression(hasDynamicSlots ? `2` : `1`, false)
|
||||
)
|
||||
),
|
||||
loc
|
||||
) as SlotsExpression
|
||||
|
||||
Reference in New Issue
Block a user