fix(compiler-core): fix directive args with empty holes
This commit is contained in:
parent
59e18e5478
commit
acf406b779
@ -141,7 +141,7 @@ export const transformElement: NodeTransform = (node, context) => {
|
|||||||
[
|
[
|
||||||
vnode,
|
vnode,
|
||||||
createArrayExpression(
|
createArrayExpression(
|
||||||
runtimeDirectives.map(dir => createDirectiveArgs(dir, context)),
|
runtimeDirectives.map(dir => buildDirectiveArgs(dir, context)),
|
||||||
loc
|
loc
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -390,7 +390,7 @@ function mergeAsArray(existing: Property, incoming: Property) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDirectiveArgs(
|
function buildDirectiveArgs(
|
||||||
dir: DirectiveNode,
|
dir: DirectiveNode,
|
||||||
context: TransformContext
|
context: TransformContext
|
||||||
): ArrayExpression {
|
): ArrayExpression {
|
||||||
@ -407,8 +407,19 @@ function createDirectiveArgs(
|
|||||||
}
|
}
|
||||||
const { loc } = dir
|
const { loc } = dir
|
||||||
if (dir.exp) dirArgs.push(dir.exp)
|
if (dir.exp) dirArgs.push(dir.exp)
|
||||||
if (dir.arg) dirArgs.push(dir.arg)
|
if (dir.arg) {
|
||||||
|
if (!dir.exp) {
|
||||||
|
dirArgs.push(`void 0`)
|
||||||
|
}
|
||||||
|
dirArgs.push(dir.arg)
|
||||||
|
}
|
||||||
if (Object.keys(dir.modifiers).length) {
|
if (Object.keys(dir.modifiers).length) {
|
||||||
|
if (!dir.arg) {
|
||||||
|
if (!dir.exp) {
|
||||||
|
dirArgs.push(`void 0`)
|
||||||
|
}
|
||||||
|
dirArgs.push(`void 0`)
|
||||||
|
}
|
||||||
dirArgs.push(
|
dirArgs.push(
|
||||||
createObjectExpression(
|
createObjectExpression(
|
||||||
dir.modifiers.map(modifier =>
|
dir.modifiers.map(modifier =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user