refactor(compiler): flush transform onExit in reverse

This commit is contained in:
Evan You
2019-10-08 16:53:26 -04:00
parent e8ee163fdd
commit 0615cf0108
4 changed files with 5 additions and 4 deletions

View File

@@ -52,9 +52,9 @@ export function baseCompile(
]
: []),
trackSlotScopes,
optimizeText,
transformSlotOutlet,
transformElement,
optimizeText,
...(options.nodeTransforms || []) // user transforms
],
directiveTransforms: {

View File

@@ -346,7 +346,8 @@ export function traverseNode(
}
// exit transforms
for (let i = 0; i < exitFns.length; i++) {
let i = exitFns.length
while (i--) {
exitFns[i]()
}
}

View File

@@ -110,7 +110,7 @@ export function buildSlots(
// since it likely uses a scope variable.
// TODO: This can be further optimized to only make it dynamic when the slot
// actually uses the scope variables.
let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0
let hasDynamicSlots = context.scopes.vSlot > 1 || context.scopes.vFor > 0
// 1. Check for default slot with slotProps on component itself.
// <Comp v-slot="{ prop }"/>