Closed lalo4ka closed 5 years ago
Yes, you can set the reducer
prop of the component to a method that will reduce values depending on whatever you want.
Here is an example of what you could do :
data: {
reduceAttr: 'count' // Can be set to 'sum', 'average' or 'count' by the user
},
methods: {
reduce: function(sum, item) {
return sum + item[this.reduceAttr]
}
}
is possible change dynamically the variable in reducer function? reducer: (sum, item) => sum + item.count