title: Vue.js Axios delete method deleting the wrong object in the array
body: <p>I have an issue where my axios.delete method is deleting the wrong objects in the array. There are 3 objects total, coming from an api, the objects with id 2 and 3 fine when I delete in the index.html file, but it throws a 'Uncaught (in promise) Error: Request failed with status code 404' error when I try to delete the first object in the array coming from my API.</p>
  
  <p>My index file (includes the delete button)</p>
  
  <pre><code> &lt;body&gt;
          &lt;div id="app"&gt;
            &lt;template v-for="(results, index) in result"&gt;
  
                &lt;div  class="card" style="width: 20rem; display:inline-block;"&gt;
                  &lt;div class="card-block"&gt;
                   &lt;p&gt;{{ results }}&lt;/p&gt;
  
                   &lt;button type="button" class="btn btn-danger pull-right" data-toggle="modal" v-on:submit.prevent="deleteData(index)" @click="deleteData(results, index) in result"&gt;Delete&lt;/button&gt;
  
                   &lt;h1&gt; {{ results.comments}} &lt;/h1&gt;
  
                &lt;/div&gt;
                &lt;/div&gt;
  
              &lt;/template&gt;
  
          &lt;/div&gt;
          &lt;script src="https://unpkg.com/axios/dist/axios.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://unpkg.com/vue"&gt;&lt;/script&gt;
          &lt;script src="src/main.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Main.js</p>
  
  <pre><code>var vm = new Vue ({
    el: '#app',
    data: {
      result: ''
    },
  
    created: function(){
      this.getResult();
    },
  
    methods: {
  
      deleteData: function(result, id) {
        axios.delete('https://my-json-server.typicode.com/json/posts/' + id)
        .then(response =&gt; {
          this.result.splice(id, 1)
          console.log(this.result);
        });
      },
  
      getResult: function() {
        // this.results = 'Loading...';
        axios.get('https://my-json-server.typicode.com/json/db')
        .then(response =&gt; {
          // console.log(response.data);
          this.result = response.data.posts;
          console.log(this.result);
        });
      }
    }
    });
  </code></pre>