]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: v-skip work with v-if/v-else/v-else-if
authordaiwei <daiwei521@126.com>
Wed, 22 Jan 2025 14:04:06 +0000 (22:04 +0800)
committerdaiwei <daiwei521@126.com>
Wed, 22 Jan 2025 14:04:06 +0000 (22:04 +0800)
packages/compiler-core/src/ast.ts
packages/compiler-core/src/utils.ts

index 2956a4b3dc337aaad11e08f1303d8fd53948f3be..a3c6bd96c031831f45eab510dfe56376fe648f4c 100644 (file)
@@ -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
 }
 
index b49d70bb2fba1d207e9ef76ab5d35cefcaec91aa..29939683eb840ab6bc4e1d010f204a9e857accf2 100644 (file)
@@ -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 {