Advertisement
Guest User

TodoComponent.vue

a guest
Nov 17th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <template>
  2. <div>
  3. <form @submit.prevent="saveData">
  4.  
  5. <div class="input-group mb-3">
  6. <input v-model="form.title" type="text" class="form-control form-control-lg" aria-label="Recipient's username" aria-describedby="button-addon2">
  7. <div class="input-group-append">
  8. <button class="btn btn-success" type="submit" id="button-addon2">Add List </button>
  9. </div>
  10. </div>
  11.  
  12.  
  13. </form>
  14.  
  15.  
  16.  
  17. </div>
  18. </template>
  19.  
  20. <script>
  21. export default {
  22. data(){
  23.  
  24. return{
  25. form: new Form({
  26. title: '',
  27.  
  28. })
  29.  
  30. }
  31.  
  32.  
  33. },
  34.  
  35. methods:{
  36. saveData(){
  37. let data = new FormData();
  38. data.append('title', this.form.title)
  39. axios.post('/api/todo', data)
  40.  
  41. }
  42. },
  43.  
  44. mounted() {
  45.  
  46. }
  47. }
  48. </script>
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement