I'm struggling with organizing the already computed array of results.
Within Vue, I have successfully filtered images based on their ratio. Now, my goal is to sort these filtered results by date, name, or any other possible category.
Although I attempted to apply a sorting method to the array, I found that this solution doesn't update automatically and reflect the changes in real-time.
data() {
return {
results: [],
imgProperties: {
imgId: [],
imgRatio: [],
imgCreateDate: []
}
};
},
computed: {
resultsFiltered() {
if (this.sliderVal == 0) {
return this.results;
} else {
const obj = [];
const arr = [];
for (let i = 0; i < this.ratioIndeces.length; i++) {
const element = this.ratioIndeces[i];
obj.push(this.results[element]);
arr.push(this.imgProperties.imgRatio[element]);
}
return obj;
}
}
},
This current setup lacks any visible sorting solution.
I'm eager to learn where and how to implement sorting functionality.
The provided code snippet illustrates a portion of the existing structure, noting that ratios are calculated within the methods.
My objective is to arrange the array by imgCreateDate
and imgRatio
.