fix: simplify and use correct ctx in withCtx

This commit is contained in:
Evan You
2020-03-16 13:06:37 -04:00
parent fd3418d79d
commit 4dc8ffc378
8 changed files with 44 additions and 45 deletions

View File

@@ -49,7 +49,8 @@ import {
WITH_DIRECTIVES,
CREATE_BLOCK,
OPEN_BLOCK,
CREATE_STATIC
CREATE_STATIC,
WITH_CTX
} from './runtimeHelpers'
import { ImportItem } from './transform'
@@ -769,7 +770,7 @@ function genFunctionExpression(
if (genScopeId) {
push(`_withId(`)
} else if (isSlot) {
push(`_withCtx(`)
push(`_${helperNameMap[WITH_CTX]}(`)
}
push(`(`, node)
if (isArray(params)) {
@@ -799,7 +800,7 @@ function genFunctionExpression(
push(`}`)
}
if (genScopeId || isSlot) {
push(`, _ctx)`)
push(`)`)
}
}