Skip to content

Document v-model.number behavior for invalid strings #1742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/v2/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@ type: api

- **Modifiers:**
- [`.lazy`](../guide/forms.html#lazy) - listen to `change` events instead of `input`
- [`.number`](../guide/forms.html#number) - cast input string to numbers
- [`.number`](../guide/forms.html#number) - cast valid input string to numbers
- [`.trim`](../guide/forms.html#trim) - trim input

- **Usage:**
Expand Down
2 changes: 1 addition & 1 deletion src/v2/guide/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ If you want user input to be automatically typecast as a number, you can add the
<input v-model.number="age" type="number">
```

This is often useful, because even with `type="number"`, the value of HTML input elements always returns a string.
This is often useful, because even with `type="number"`, the value of HTML input elements always returns a string. If the value cannot be parsed with `parseFloat()`, then the original value is returned.

### `.trim`

Expand Down