feat(compiler-core): wrap slot functions with render context

This commit is contained in:
Evan You
2020-03-16 11:23:29 -04:00
parent bcb750bb3a
commit ecd7ce60d5
13 changed files with 114 additions and 88 deletions

View File

@@ -768,6 +768,8 @@ function genFunctionExpression(
if (genScopeId) {
push(`_withId(`)
} else if (isSlot) {
push(`_withCtx(`)
}
push(`(`, node)
if (isArray(params)) {
@@ -796,8 +798,8 @@ function genFunctionExpression(
deindent()
push(`}`)
}
if (genScopeId) {
push(`)`)
if (genScopeId || isSlot) {
push(`, _ctx)`)
}
}