Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // OBJECTS
  2.  
  3. user: {
  4. email: '',
  5. password: ''
  6. }
  7.  
  8. formFields: [
  9. { name: 'email', type: 'text', required: true },
  10. { name: 'password', type: 'password', required: true }
  11. ]
  12.  
  13. // HTML
  14.  
  15. <input :type="getPropType($key)"
  16.  
  17. // FUNCTION
  18.  
  19. getPropType (key) {
  20. console.log(this.fields)
  21. console.log(key)
  22. return this.fields.map(field => {
  23. if (field.name === key) return field.type
  24. })
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement