Answer the question
In order to leave comments, you need to log in
How to use filter + sort at the same time in Vue?
There are two filters for selecting from products by them, how best and more correctly to implement sorting and filtering together?
That is, when choosing a Category, the filter should also be taken into account in the opposite direction, too, so far it turned out to do only a separate sorting by price and name, I did it through .sort((a, b) => a.price < b.price ? 1 : -1 );
When choosing a category, I use .filter(), but it filters inside the array, but does not output, that is, when sorting is applied, everything is displayed at once (products in the component are redrawn), but not when filtering.
Tell me where to look, maybe there is an example, thanks in advance
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