I'm currently working on animating the width of an element based on data retrieved from an API when the page loads, and I'm utilizing Vue.js for this task. I have successfully applied the width value from the API data using inline CSS, but I am facing an issue with achieving the desired animation effect.
Edited Vue Template:
<li v-for="(stats, index) in teamStats[0]">
<div class="bar">
<span :style="'width:'+ stats +'%;'">
{{stats}}
</span>
</div>
</li>
Sass:
.bar {
span {
text-align: $l;
right: 0;
width: 0%;
-webkit-transition: width 1s;
-moz-transition: width 1s;
-o-transition: width 1s;
transition: width 1s;
}
}