Answer the question
In order to leave comments, you need to log in
How to limit the output of elements in Vue.js?
There is the following code, which displays items in ascending or descending order.
showedItems: function () {
return this.items.filter((item) => {
return (this.keyword.length === 0 || item.name.includes(this.keyword))
}).sort((a, b) => {
if (this.sortBy == 'PriceMinMax') {
return (a.fullCost-b.fullCost);
}
else if (this.sortBy =='PriceMaxMin') {
return (b.fullCost-a.fullCost);
}
}
)
}
const addCount = 5;
showedItems() {
return this.items.slice(0, this.showedItemsCount)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question