fix(v-model): enable v-model type detection on custom elements
This commit is contained in:
parent
04a4ebaaeb
commit
0b3b1cfa48
@ -44,15 +44,16 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { tag } = node
|
const { tag } = node
|
||||||
|
const isCustomElement = context.isCustomElement(tag)
|
||||||
if (
|
if (
|
||||||
tag === 'input' ||
|
tag === 'input' ||
|
||||||
tag === 'textarea' ||
|
tag === 'textarea' ||
|
||||||
tag === 'select' ||
|
tag === 'select' ||
|
||||||
context.isCustomElement(tag)
|
isCustomElement
|
||||||
) {
|
) {
|
||||||
let directiveToUse = V_MODEL_TEXT
|
let directiveToUse = V_MODEL_TEXT
|
||||||
let isInvalidType = false
|
let isInvalidType = false
|
||||||
if (tag === 'input') {
|
if (tag === 'input' || isCustomElement) {
|
||||||
const type = findProp(node, `type`)
|
const type = findProp(node, `type`)
|
||||||
if (type) {
|
if (type) {
|
||||||
if (type.type === NodeTypes.DIRECTIVE) {
|
if (type.type === NodeTypes.DIRECTIVE) {
|
||||||
@ -91,9 +92,8 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
|
|||||||
}
|
}
|
||||||
} else if (tag === 'select') {
|
} else if (tag === 'select') {
|
||||||
directiveToUse = V_MODEL_SELECT
|
directiveToUse = V_MODEL_SELECT
|
||||||
}
|
} else {
|
||||||
{
|
// textarea
|
||||||
// textarea or custom elements
|
|
||||||
__DEV__ && checkDuplicatedValue()
|
__DEV__ && checkDuplicatedValue()
|
||||||
}
|
}
|
||||||
// inject runtime directive
|
// inject runtime directive
|
||||||
|
Loading…
x
Reference in New Issue
Block a user