fix(runtime-core): should not track dynamic children when the user calls a compiled slot inside template expression (#3554)

fix #3548, partial fix for #3569
This commit is contained in:
HcySunYang
2021-05-26 01:33:41 +08:00
committed by GitHub
parent 1526f94edf
commit 201060717d
7 changed files with 175 additions and 34 deletions

View File

@@ -37,6 +37,7 @@ import {
import { resolveFilter } from '../helpers/resolveAssets'
import { resolveMergedOptions } from '../componentOptions'
import { InternalSlots, Slots } from '../componentSlots'
import { ContextualRenderFn } from '../componentRenderContext'
export type LegacyPublicInstance = ComponentPublicInstance &
LegacyPublicProperties
@@ -106,7 +107,7 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
const res: InternalSlots = {}
for (const key in i.slots) {
const fn = i.slots[key]!
if (!(fn as any)._nonScoped) {
if (!(fn as ContextualRenderFn)._ns /* non-scoped slot */) {
res[key] = fn
}
}

View File

@@ -281,7 +281,7 @@ function convertLegacySlots(vnode: VNode): VNode {
for (const key in slots) {
const slotChildren = slots[key]
slots[key] = () => slotChildren
slots[key]._nonScoped = true
slots[key]._ns = true /* non-scoped slot */
}
}
}