0👍
Are you sure you’re in the right range?
Perhaps your values range from [0,100] and the expected value ranges [0.0,1.0].
0👍
Okay, I got it fixed by changing the computed to the following:
computed: {
getOverallScore: function () {
var i;
var sum = 0;
// Will get all reviews through API calls
for (i = 0; i < this.items.length; i++) {
sum = sum + this.items[i].score;
}
this.average = Number.parseFloat(sum / this.items.length).toFixed(2);
return Number.parseFloat(sum / this.items.length);
},
}
Apparently when I use .toFixed(2)
, the b-progress
no longer recognises the value as a number but as a string. I tried to convert it using Number(this.average)
and return that still does not work. I found this very strange though, as the toFixed
function is part of the built in library and somehow it does not recognise it as a function. The output value is fine so the toFixed
function works. No idea why it does that.
- [Vuejs]-How to make a vuejs application work with IE 11 when using feathersjs
- [Vuejs]-"Sending" data from vuex store to component
Source:stackexchange.com