Skip to content

Commit 0b3b1cf

Browse files
committed
fix(v-model): enable v-model type detection on custom elements
1 parent 04a4eba commit 0b3b1cf

File tree

1 file changed

+5
-5
lines changed
  • packages/compiler-dom/src/transforms

1 file changed

+5
-5
lines changed

packages/compiler-dom/src/transforms/vModel.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
4444
}
4545

4646
const { tag } = node
47+
const isCustomElement = context.isCustomElement(tag)
4748
if (
4849
tag === 'input' ||
4950
tag === 'textarea' ||
5051
tag === 'select' ||
51-
context.isCustomElement(tag)
52+
isCustomElement
5253
) {
5354
let directiveToUse = V_MODEL_TEXT
5455
let isInvalidType = false
55-
if (tag === 'input') {
56+
if (tag === 'input' || isCustomElement) {
5657
const type = findProp(node, `type`)
5758
if (type) {
5859
if (type.type === NodeTypes.DIRECTIVE) {
@@ -91,9 +92,8 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
9192
}
9293
} else if (tag === 'select') {
9394
directiveToUse = V_MODEL_SELECT
94-
}
95-
{
96-
// textarea or custom elements
95+
} else {
96+
// textarea
9797
__DEV__ && checkDuplicatedValue()
9898
}
9999
// inject runtime directive

0 commit comments

Comments
 (0)