|
|
@@ -29,6 +29,7 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
|
|
|
|
|
|
if (tag === 'input' || tag === 'textarea' || tag === 'select') {
|
|
|
let directiveToUse = V_MODEL_TEXT
|
|
|
+ let isInvalidType = false
|
|
|
if (tag === 'input') {
|
|
|
const type = findProp(node, `type`)
|
|
|
if (type) {
|
|
|
@@ -43,6 +44,15 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
|
|
|
case 'checkbox':
|
|
|
directiveToUse = V_MODEL_CHECKBOX
|
|
|
break
|
|
|
+ case 'file':
|
|
|
+ isInvalidType = true
|
|
|
+ context.onError(
|
|
|
+ createDOMCompilerError(
|
|
|
+ DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT,
|
|
|
+ dir.loc
|
|
|
+ )
|
|
|
+ )
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -51,8 +61,10 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
|
|
|
}
|
|
|
// inject runtime directive
|
|
|
// by returning the helper symbol via needRuntime
|
|
|
- // the import will replace the resovleDirective call.
|
|
|
- res.needRuntime = context.helper(directiveToUse)
|
|
|
+ // the import will replaced a resovleDirective call.
|
|
|
+ if (!isInvalidType) {
|
|
|
+ res.needRuntime = context.helper(directiveToUse)
|
|
|
+ }
|
|
|
} else {
|
|
|
context.onError(
|
|
|
createDOMCompilerError(
|