Sorting by function output in v-for loop in Vue.js

You can create a custom computed property which acts like a function to sort the plans array:

computed: {
  sortedPlans: function(){
    return this.plans.sort(....
  }
}
<template v-for="plan in sortedPlans">
   ...
</template>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top