committed by
GitHub
parent
d7f1b771f8
commit
c00925ed5c
@@ -67,6 +67,7 @@ export const enum ErrorCodes {
|
||||
X_INVALID_END_TAG,
|
||||
X_MISSING_END_TAG,
|
||||
X_MISSING_INTERPOLATION_END,
|
||||
X_MISSING_DIRECTIVE_NAME,
|
||||
X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END,
|
||||
|
||||
// transform errors
|
||||
@@ -143,6 +144,7 @@ export const errorMessages: Record<ErrorCodes, string> = {
|
||||
[ErrorCodes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END]:
|
||||
'End bracket for dynamic directive argument was not found. ' +
|
||||
'Note that dynamic directive argument cannot contain spaces.',
|
||||
[ErrorCodes.X_MISSING_DIRECTIVE_NAME]: 'Legal directive name was expected.',
|
||||
|
||||
// transform errors
|
||||
[ErrorCodes.X_V_IF_NO_EXPRESSION]: `v-if/v-else-if is missing expression.`,
|
||||
|
||||
@@ -775,7 +775,7 @@ function parseAttribute(
|
||||
}
|
||||
const loc = getSelection(context, start)
|
||||
|
||||
if (!context.inVPre && /^(v-|:|\.|@|#)/.test(name)) {
|
||||
if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
|
||||
const match =
|
||||
/(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
|
||||
name
|
||||
@@ -888,6 +888,11 @@ function parseAttribute(
|
||||
}
|
||||
}
|
||||
|
||||
// missing directive name or illegal directive name
|
||||
if (!context.inVPre && startsWith(name, 'v-')) {
|
||||
emitError(context, ErrorCodes.X_MISSING_DIRECTIVE_NAME)
|
||||
}
|
||||
|
||||
return {
|
||||
type: NodeTypes.ATTRIBUTE,
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user