From: daiwei Date: Wed, 22 Jan 2025 14:04:06 +0000 (+0800) Subject: wip: v-skip work with v-if/v-else/v-else-if X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=80c1e5c3231545917b1d04f3545aa4ae95e7a3a2;p=thirdparty%2Fvuejs%2Fcore.git wip: v-skip work with v-if/v-else/v-else-if --- diff --git a/packages/compiler-core/src/ast.ts b/packages/compiler-core/src/ast.ts index 2956a4b3dc..a3c6bd96c0 100644 --- a/packages/compiler-core/src/ast.ts +++ b/packages/compiler-core/src/ast.ts @@ -556,7 +556,7 @@ export interface DynamicSlotFnProperty extends Property { export type BlockCodegenNode = VNodeCall | RenderSlotCall export interface IfConditionalExpression extends ConditionalExpression { - consequent: BlockCodegenNode | MemoExpression + consequent: BlockCodegenNode | MemoExpression | ConditionalExpression alternate: BlockCodegenNode | IfConditionalExpression | MemoExpression } diff --git a/packages/compiler-core/src/utils.ts b/packages/compiler-core/src/utils.ts index b49d70bb2f..29939683eb 100644 --- a/packages/compiler-core/src/utils.ts +++ b/packages/compiler-core/src/utils.ts @@ -397,7 +397,11 @@ export function injectProp( * we need to get the real props before normalization */ let props = - node.type === NodeTypes.VNODE_CALL ? node.props : node.arguments[2] + node.type === NodeTypes.VNODE_CALL + ? node.props + : node.type === NodeTypes.JS_CALL_EXPRESSION + ? node.arguments[2] + : undefined let callPath: CallExpression[] = [] let parentCall: CallExpression | undefined if ( @@ -459,7 +463,7 @@ export function injectProp( } else { node.props = propsWithInjection } - } else { + } else if (node.type === NodeTypes.JS_CALL_EXPRESSION) { if (parentCall) { parentCall.arguments[0] = propsWithInjection } else {