Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Vue.js List Rendering: One Solution

Juan Gomez
Juan Gomez
806 Points

delete news impelled but unexpected result (Vue,js)

I have implemented and option for deleting news , however im getting an unexpected result. element deleted after clicking delete icon is deleting always last element of the orderedList.

<span class="delete-card" v-on:click="orderList.splice(post.index,1)">X</span>

and app.js

computed: {

orderList: function() {
  return this.posts.sort((currentPost, nextPost) => {
    return nextPost.votes - currentPost.votes;
    console.log(nextPost.votes - currentPost.votes)
  });
}

}

I'm looping through the orderedList <div class="post" v-for="(post,index) in orderList">