[Vuejs]-Sort A-Z and Z-A in an array on clicking bootstrap dropdown

0👍

list.sort((a,b)=>{
  if(a.name.toUpperCase() < b.name.toUpperCase()) { return -1; }
    if(a.name.toUpperCase() > b.name.toUpperCase()) { return 1; }
    return 0;
})

//To Get the vice versa just interchange the less than (<) and greater than sign (>)

The result will be enter image description here

You can assign it to a new data and put it inside your dropdown. Maybe sort your data inside mounted.

Leave a comment