Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. // with v-model
  2. <input v-model="email" class="form-input" placeholder="you@example.com">
  3.  
  4. // without v-model
  5. <input :value="email" @input="email = $event.target.value" class="form-input" placeholder="you@example.com">
  6.  
  7. data() {
  8. return {
  9. email: 'test@test.com'
  10. }
  11. }
  12.  
  13. // Controlled Componenet
  14. - The value, or state, of the input is controlled by the parent
  15. - A component that doesn't have any of its own state, but is controlled by state in the parent
  16. - it communicates with the parent by firing events anytime the user has tried to change the value of the component
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement