title: sorting list of object by property in VueJS
body: <p>I have just started to learn VueJS 2 and the more questions I have the harder it becomes.</p>
  
  <p>The idea is that I have a sample problem with an array of objects, where I want to sort the array by "votes" property, which can be dynamically updated for each separate element. I want to sort my list by votes dynamically. Thus the question is how can I do that without doing weird code.</p>
  
  <p>In angular you will do something like </p>
  
  <pre><code>for candidate in candidates | orderBy: 'votes'
  </code></pre>
  
  <p>but in here I could of though only of something like</p>
  
  <pre><code>v-for="(value, index, key) in sorted_candidates"
  </code></pre>
  
  <p>where in .js I'll have </p>
  
  <pre><code> computed : {
        sorted_candidates() {
            return this.candidates.sort((a, b) =&gt; { return b.votes - a.votes;});
        }
    }
  </code></pre>
  
  <p>So my question would be if there is a more elegant way to solve this problem?
  Note: I am sorting on object property.</p>