fix(v-model): allow v-model usage on declared custom elements

fix #1699
This commit is contained in:
Evan You
2020-07-27 17:09:21 -04:00
parent 2a633c84ff
commit 71c3c6e2a0
5 changed files with 43 additions and 3 deletions

View File

@@ -44,7 +44,12 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
}
const { tag } = node
if (tag === 'input' || tag === 'textarea' || tag === 'select') {
if (
tag === 'input' ||
tag === 'textarea' ||
tag === 'select' ||
context.isCustomElement(tag)
) {
let directiveToUse = V_MODEL_TEXT
let isInvalidType = false
if (tag === 'input') {
@@ -86,7 +91,9 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
}
} else if (tag === 'select') {
directiveToUse = V_MODEL_SELECT
} else if (tag === 'textarea') {
}
{
// textarea or custom elements
__DEV__ && checkDuplicatedValue()
}
// inject runtime directive