wangdahoo / vue-animate-number

animate-number as a vue component.
https://wangdahoo.github.io/vue-animate-number/
107 stars 18 forks source link

Cant animate to decimal number #2

Open satriani04 opened 7 years ago

satriani04 commented 7 years ago

Hi..

thank you for created this awesome component. but I found a little problem in my project. I have a decimal value, for example 4.50, and in my project it animated from 1 to 4. what I want to do is animate number from 1 to decimal value, example 1 to 4.50. is that possible?

regards

ttc9082 commented 6 years ago
<animate-number 
    from="1"
    to="4.5"
    duration="1000"
    easing="easeOutQuad"
    :formatter="formatter">
</animate-number>

formatter: function (num) {
    return num.toFixed(2)
},

use formatter