fix(slots): properly force update on forwarded slots

fix #1594
This commit is contained in:
Evan You
2020-07-15 20:12:49 -04:00
parent 44e6da1402
commit aab99abd28
7 changed files with 99 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ import { makeMap } from './makeMap'
export { makeMap }
export * from './patchFlags'
export * from './shapeFlags'
export * from './slotFlags'
export * from './globalsWhitelist'
export * from './codeframe'
export * from './mockWarn'

View File

@@ -0,0 +1,21 @@
export const enum SlotFlags {
/**
* Stable slots that only reference slot props or context state. The slot
* can fully capture its own dependencies so when passed down the parent won't
* need to force the child to update.
*/
STABLE = 1,
/**
* Slots that reference scope variables (v-for or an outer slot prop), or
* has conditional structure (v-if, v-for). The parent will need to force
* the child to update because the slot does not fully capture its dependencies.
*/
DYNAMIC = 2,
/**
* <slot/> being forwarded into a child component. Whether the parent needs
* to update the child is dependent on what kind of slots the parent itself
* received. This has to be refined at runtime, when the child's vnode
* is being created (in `normalizeChildren`)
*/
FORWARDED = 3
}