wip: exclude legacy slots from $scopedSlots
This commit is contained in:
@@ -129,11 +129,6 @@ export function buildSlots(
|
||||
const slotsProperties: Property[] = []
|
||||
const dynamicSlots: (ConditionalExpression | CallExpression)[] = []
|
||||
|
||||
const buildDefaultSlotProperty = (
|
||||
props: ExpressionNode | undefined,
|
||||
children: TemplateChildNode[]
|
||||
) => createObjectProperty(`default`, buildSlotFn(props, children, loc))
|
||||
|
||||
// If the slot is inside a v-for or another v-slot, force it to be dynamic
|
||||
// since it likely uses a scope variable.
|
||||
let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0
|
||||
@@ -302,6 +297,17 @@ export function buildSlots(
|
||||
}
|
||||
|
||||
if (!onComponentSlot) {
|
||||
const buildDefaultSlotProperty = (
|
||||
props: ExpressionNode | undefined,
|
||||
children: TemplateChildNode[]
|
||||
) => {
|
||||
const fn = buildSlotFn(props, children, loc)
|
||||
if (__COMPAT__) {
|
||||
fn.isNonScopedSlot = true
|
||||
}
|
||||
return createObjectProperty(`default`, fn)
|
||||
}
|
||||
|
||||
if (!hasTemplateSlots) {
|
||||
// implicit default slot (on component)
|
||||
slotsProperties.push(buildDefaultSlotProperty(undefined, children))
|
||||
|
||||
Reference in New Issue
Block a user