Guest User

Untitled

a guest
Jul 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <template>
  2. <div>
  3. <h1>FORM</h1>
  4. <form>
  5. <input type="text" name="" id="sname" placeholder="Name of School" v-model="namesc"><br>
  6. <input type="text" name="" id="saddress" placeholder="Address" v-model="addrsc"><br>
  7. <select name="" id="" v-model="modstate">
  8. <option value="" v-for="state in states">{{state}}</option>
  9. </select><br>
  10. <textarea name="" id="sdesc" cols="30" rows="10" v-model="dessc"></textarea><br>
  11. <button @click.prevent="addinfo">add</button>
  12. </form>
  13. <div>
  14. <p v-for="schname in schnames">Name: {{schname}}</p>
  15. <p v-for="address in addresses">Address: {{address}}</p>
  16. <p>State: {{modstate}}</p>
  17. <p v-for="description in descriptions">Description: {{description}}</p>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. export default {
  23. data () {
  24. return {
  25. states : ['Abia','Adamawa','Akwa-Ibom','Anambra','Bayelsa'],
  26. namesc:'',
  27. addrsc:'',
  28. dessc:'',
  29. modstate:'',
  30. schnames: [],
  31. addresses :[],
  32. // modelStates :[],
  33. descriptions :[]
  34. }
  35. },
  36. methods: {
  37. addinfo:function(){
  38. if (this.namesc !== ''){
  39. this.schnames.push(this.namesc);
  40. this.addresses.push(this.addrsc);
  41. this.descriptions.push(this.dessc);
  42. // this.modelStates.push(this.modstate);
  43. this.namesc = '';
  44. this.addrsc = '';
  45. this.dessc = '';
  46. this.modstate = '';
  47. }
  48. }
  49. }
  50. }
  51. </script>
  52. <style scoped>
  53.  
  54. </style>
  55.  
  56.  
  57.  
  58. Thanks a lot.Got it, thanks!Thanks
Add Comment
Please, Sign In to add comment