Skip to content

Commit

Permalink
fix(v-model): enable v-model type detection on custom elements
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 28, 2020
1 parent 04a4eba commit 0b3b1cf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/compiler-dom/src/transforms/vModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0b3b1cf

Please sign in to comment.