You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This interface can be used not only to connect with form inputs inside a component, but also to easily integrate input types that you invent yourself. Imagine these possibilities:
634
+
The implementation above is pretty naive though. For example, users are allowed to enter multiple periods and even letters sometimes - yuck! So for those that want to see a non-trivial example, here's a more robust currency filter:
Copy file name to clipboardExpand all lines: src/guide/forms.md
+15-1Lines changed: 15 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -296,7 +296,8 @@ But sometimes we may want to bind the value to a dynamic property on the Vue ins
296
296
type="checkbox"
297
297
v-model="toggle"
298
298
v-bind:true-value="a"
299
-
v-bind:false-value="b">
299
+
v-bind:false-value="b"
300
+
>
300
301
```
301
302
302
303
```js
@@ -360,3 +361,16 @@ If you want user input to be trimmed automatically, you can add the `trim` modif
360
361
```html
361
362
<inputv-model.trim="msg">
362
363
```
364
+
365
+
## `v-model` with Components
366
+
367
+
> If you're not yet familiar with Vue's components, just skip this for now.
368
+
369
+
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#Form-Input-Components-using-Custom-Events) in the Components guide.
0 commit comments