Answer the question
In order to leave comments, you need to log in
How to display an unsorted array when sorting?
There is a code:
computed: {
sorted() {
const compare = (a, b) => {
if (sortingType === '2') {
return b.name- a.name
}
if (sortingType === '3') {
return a.name- b.name
}
return 0;
};
return this.arr.sort(compare);
}
},
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