Skip to content

Commit df72c7e

Browse files
authored
Update forms.md (#2489)
Minor copy edits and formatting tweaks
1 parent fd246eb commit df72c7e

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Diff for: src/v2/guide/forms.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ order: 10
88

99
You can use the `v-model` directive to create two-way data bindings on form input, textarea, and select elements. It automatically picks the correct way to update the element based on the input type. Although a bit magical, `v-model` is essentially syntax sugar for updating data on user input events, plus special care for some edge cases.
1010

11-
<p class="tip">`v-model` will ignore the initial `value`, `checked` or `selected` attributes found on any form elements. It will always treat the Vue instance data as the source of truth. You should declare the initial value on the JavaScript side, inside the `data` option of your component.</p>
11+
<p class="tip">`v-model` will ignore the initial `value`, `checked`, or `selected` attributes found on any form elements. It will always treat the Vue instance data as the source of truth. You should declare the initial value on the JavaScript side, inside the `data` option of your component.</p>
1212

1313
`v-model` internally uses different properties and emits different events for different input elements:
1414
- text and textarea elements use `value` property and `input` event;
1515
- checkboxes and radiobuttons use `checked` property and `change` event;
1616
- select fields use `value` as a prop and `change` as an event.
1717

18-
<p class="tip" id="vmodel-ime-tip">For languages that require an [IME](https://en.wikipedia.org/wiki/Input_method) (Chinese, Japanese, Korean etc.), you'll notice that `v-model` doesn't get updated during IME composition. If you want to cater for these updates as well, use `input` event instead.</p>
18+
<p class="tip" id="vmodel-ime-tip">For languages that require an [IME](https://en.wikipedia.org/wiki/Input_method) (Chinese, Japanese, Korean, etc.), you'll notice that `v-model` doesn't get updated during IME composition. If you want to cater to these updates as well, use the `input` event instead.</p>
1919

2020
### Text
2121

@@ -209,7 +209,7 @@ new Vue({
209209
</script>
210210
{% endraw %}
211211

212-
<p class="tip">If the initial value of your `v-model` expression does not match any of the options, the `<select>` element will render in an "unselected" state. On iOS this will cause the user not being able to select the first item because iOS does not fire a change event in this case. It is therefore recommended to provide a disabled option with an empty value, as demonstrated in the example above.</p>
212+
<p class="tip">If the initial value of your `v-model` expression does not match any of the options, the `<select>` element will render in an "unselected" state. On iOS, this will prevent the user from being able to select the first item, because iOS does not fire a `change` event in this case. It is therefore recommended to provide a `disabled` option with an empty value, as demonstrated in the example above.</p>
213213

214214
Multiple select (bound to Array):
215215

@@ -291,7 +291,7 @@ new Vue({
291291

292292
## Value Bindings
293293

294-
For radio, checkbox and select options, the `v-model` binding values are usually static strings (or booleans for checkbox):
294+
For radio, checkbox and select options, the `v-model` binding values are usually static strings (or booleans for checkboxes):
295295

296296
``` html
297297
<!-- `picked` is a string "a" when checked -->
@@ -306,7 +306,7 @@ For radio, checkbox and select options, the `v-model` binding values are usually
306306
</select>
307307
```
308308

309-
But sometimes we may want to bind the value to a dynamic property on the Vue instance. We can use `v-bind` to achieve that. In addition, using `v-bind` allows us to bind the input value to non-string values.
309+
But sometimes, we may want to bind the value to a dynamic property on the Vue instance. We can use `v-bind` to achieve that. In addition, using `v-bind` allows us to bind the input value to non-string values.
310310

311311
### Checkbox
312312

@@ -326,7 +326,7 @@ vm.toggle === 'yes'
326326
vm.toggle === 'no'
327327
```
328328

329-
<p class="tip">The `true-value` and `false-value` attributes don't affect the input's `value` attribute, because browsers don't include unchecked boxes in form submissions. To guarantee that one of two values is submitted in a form (e.g. "yes" or "no"), use radio inputs instead.</p>
329+
<p class="tip">The `true-value` and `false-value` attributes don't affect the input's `value` attribute, because browsers don't include unchecked boxes in form submissions. To guarantee that one of two values is submitted in a form (i.e. "yes" or "no"), use radio inputs instead.</p>
330330

331331
### Radio
332332

@@ -358,7 +358,7 @@ vm.selected.number // => 123
358358

359359
### `.lazy`
360360

361-
By default, `v-model` syncs the input with the data after each `input` event (with the exception of IME composition as [stated above](#vmodel-ime-tip)). You can add the `lazy` modifier to instead sync after `change` events:
361+
By default, `v-model` syncs the input with the data after each `input` event (with the exception of IME composition, as [stated above](#vmodel-ime-tip)). You can add the `lazy` modifier to instead sync _after_ `change` events:
362362

363363
``` html
364364
<!-- synced after "change" instead of "input" -->
@@ -367,7 +367,7 @@ By default, `v-model` syncs the input with the data after each `input` event (wi
367367

368368
### `.number`
369369

370-
If you want user input to be automatically typecast as a number, you can add the `number` modifier to your `v-model` managed inputs:
370+
If you want user input to be automatically typecast as a Number, you can add the `number` modifier to your `v-model` managed inputs:
371371

372372
``` html
373373
<input v-model.number="age" type="number">
@@ -387,4 +387,6 @@ If you want whitespace from user input to be trimmed automatically, you can add
387387

388388
> If you're not yet familiar with Vue's components, you can skip this for now.
389389
390-
HTML's built-in input types won't always meet your needs. Fortunately, Vue components allow you to build reusable inputs with completely customized behavior. These inputs even work with `v-model`! To learn more, read about [custom inputs](components.html#Using-v-model-on-Components) in the Components guide.
390+
HTML's built-in input types won't always meet your needs. Fortunately, Vue components allow you to build reusable inputs with completely customized behavior. These inputs even work with `v-model`!
391+
392+
To learn more, read about [custom inputs](components.html#Using-v-model-on-Components) in the Components guide.

0 commit comments

Comments
 (0)