Skip to content

Commit bd8df96

Browse files
authored
v-model.number: clarify unexpected behavior
1 parent 9a4c812 commit bd8df96

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/guide/essentials/forms.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,9 @@ If you want user input to be automatically typecast as a number, you can add the
442442
<input v-model.number="age" />
443443
```
444444

445-
If the value cannot be parsed with `parseFloat()`, then the original value is used instead.
445+
:::warning
446+
If the value cannot be parsed with `parseFloat()`, then the original (string) value is used instead. In particular, if the input is empty (for instance after the user clearing the input field), an empty string is returned. This behavior differs from the [DOM property `valueAsNumber`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#valueasnumber).
447+
:::
446448

447449
The `number` modifier is applied automatically if the input has `type="number"`.
448450

0 commit comments

Comments
 (0)