[Vuejs]-VueJS + Firebase trouble with orderBy

0👍

Well this can be solved trivially. First, your sortBy data needs to be in your data object, not in the main component:

data: function() {
    return {
        items: [],
        sortBy: 'name'
    }
}

Also you have this in your code:

<th v-on="click: sortKey = 'age'">Age</th>

Which is incorrect, and should be:

<th v-on:click="sortKey = 'age'">Age</th>

Also worth noting that you will probably need to use a custom filter, as the default orderBy filter only seems to sort numeric values.

Working example: http://www.webpackbin.com/Vk-AEaM6-

Leave a comment