daiwei 1 год назад
Родитель
Сommit
4dbcd896a1

+ 1 - 1
packages/compiler-core/src/ast.ts

@@ -556,7 +556,7 @@ export interface DynamicSlotFnProperty extends Property {
 export type BlockCodegenNode = VNodeCall | RenderSlotCall
 export type BlockCodegenNode = VNodeCall | RenderSlotCall
 
 
 export interface IfConditionalExpression extends ConditionalExpression {
 export interface IfConditionalExpression extends ConditionalExpression {
-  consequent: BlockCodegenNode | MemoExpression | ConditionalExpression
+  consequent: BlockCodegenNode | MemoExpression
   alternate: BlockCodegenNode | IfConditionalExpression | MemoExpression
   alternate: BlockCodegenNode | IfConditionalExpression | MemoExpression
 }
 }
 
 

+ 2 - 0
packages/compiler-core/src/errors.ts

@@ -93,6 +93,7 @@ export enum ErrorCodes {
   X_V_SKIP_NO_EXPRESSION,
   X_V_SKIP_NO_EXPRESSION,
   X_V_SKIP_ON_TEMPLATE,
   X_V_SKIP_ON_TEMPLATE,
   X_V_SKIP_UNEXPECTED_SLOT,
   X_V_SKIP_UNEXPECTED_SLOT,
+  X_V_SKIP_WITH_V_FOR,
 
 
   // generic errors
   // generic errors
   X_PREFIX_ID_NOT_SUPPORTED,
   X_PREFIX_ID_NOT_SUPPORTED,
@@ -185,6 +186,7 @@ export const errorMessages: Record<ErrorCodes, string> = {
   [ErrorCodes.X_V_SKIP_NO_EXPRESSION]: `v-skip is missing expression.`,
   [ErrorCodes.X_V_SKIP_NO_EXPRESSION]: `v-skip is missing expression.`,
   [ErrorCodes.X_V_SKIP_ON_TEMPLATE]: `v-skip cannot be used on <template> or <slot> tags.`,
   [ErrorCodes.X_V_SKIP_ON_TEMPLATE]: `v-skip cannot be used on <template> or <slot> tags.`,
   [ErrorCodes.X_V_SKIP_UNEXPECTED_SLOT]: `v-skip directive requires the component to have a default slot without slot props`,
   [ErrorCodes.X_V_SKIP_UNEXPECTED_SLOT]: `v-skip directive requires the component to have a default slot without slot props`,
+  [ErrorCodes.X_V_SKIP_WITH_V_FOR]: `v-skip with v-for is not supported.`,
 
 
   // generic errors
   // generic errors
   [ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
   [ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED]: `"prefixIdentifiers" option is not supported in this build of compiler.`,

+ 5 - 0
packages/compiler-core/src/transforms/vSkip.ts

@@ -15,6 +15,7 @@ import {
 import {
 import {
   ErrorCodes,
   ErrorCodes,
   createCompilerError,
   createCompilerError,
+  findDir,
   findProp,
   findProp,
   isSlotOutlet,
   isSlotOutlet,
   isTemplateNode,
   isTemplateNode,
@@ -32,6 +33,10 @@ export const transformSkip: NodeTransform = createStructuralDirectiveTransform(
       return
       return
     }
     }
 
 
+    if (findDir(node, 'for')) {
+      context.onWarn(createCompilerError(ErrorCodes.X_V_SKIP_WITH_V_FOR, loc))
+    }
+
     if (!dir.exp || !(dir.exp as SimpleExpressionNode).content.trim()) {
     if (!dir.exp || !(dir.exp as SimpleExpressionNode).content.trim()) {
       context.onError(
       context.onError(
         createCompilerError(ErrorCodes.X_V_SKIP_NO_EXPRESSION, loc),
         createCompilerError(ErrorCodes.X_V_SKIP_NO_EXPRESSION, loc),