[Vuejs]-How to maintain original array sort order with Vue.js

3๐Ÿ‘

โœ…

As far as I understood your question:

You could call sortMyItems(items) in the created Lifecycle Hook and store the result in a property of data.

Then, you can iterate over that property in your v-for:

export default {
    data() {
        return {
            sortedData: [];
        }
    },
    created() {
        this.sortedData = sortMyItems(items)
    }
}

Leave a comment