fix(v-model): enable v-model type detection on custom elements

This commit is contained in:
Evan You 2020-07-28 11:44:27 -04:00
parent 04a4ebaaeb
commit 0b3b1cfa48

View File

@ -44,15 +44,16 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
}
const { tag } = node
const isCustomElement = context.isCustomElement(tag)
if (
tag === 'input' ||
tag === 'textarea' ||
tag === 'select' ||
context.isCustomElement(tag)
isCustomElement
) {
let directiveToUse = V_MODEL_TEXT
let isInvalidType = false
if (tag === 'input') {
if (tag === 'input' || isCustomElement) {
const type = findProp(node, `type`)
if (type) {
if (type.type === NodeTypes.DIRECTIVE) {
@ -91,9 +92,8 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
}
} else if (tag === 'select') {
directiveToUse = V_MODEL_SELECT
}
{
// textarea or custom elements
} else {
// textarea
__DEV__ && checkDuplicatedValue()
}
// inject runtime directive