stepbysteptomathpro
stepbysteptomathpro

Reputation: 465

Vue.js rewriting orderBy Filter in v-for

Since the orderBy Filter is removed in vue.js v-2 I want to now how one can rewrite this codepart:

<li class="day" v-for="day in days | orderBy 'unix' 1" v-bind:class="{ 'outside': day.outsideOfCurrentMonth, 'empty': day.events.length === 0 }">

I thought of writing

<li class="day" v-for="day in orderedDays"{{}}>

but I don't know what to write in the brackets and what to write in orderBy():

computed: {
  orderedDays: function () {
    return _.orderBy()
  }
}

Here is the full component. Can someone help?

Upvotes: 0

Views: 403

Answers (1)

Michal Lev&#253;
Michal Lev&#253;

Reputation: 37773

<li class="day" v-for="day in orderedDays">
computed: {
  orderedDays: function () {
    return _.orderBy(this.days, ['unix'], ['asc'])
  }
}

Upvotes: 1

Related Questions