Skip to content

Commit

Permalink
v-model.number: clarify unexpected behavior (#2975)
Browse files Browse the repository at this point in the history
* v-model.number: clarify unexpected behavior

* v-model.number: clarify unexpected behavior (not a warning!)
  • Loading branch information
simon04 authored Sep 16, 2024
1 parent ac7a921 commit a961225
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/guide/essentials/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ If you want user input to be automatically typecast as a number, you can add the
<input v-model.number="age" />
```

If the value cannot be parsed with `parseFloat()`, then the original value is used instead.
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).

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

Expand Down

0 comments on commit a961225

Please sign in to comment.