I want to create div's dynamically based on the number of elements present in an array. The div's contain the html element created by ProgressBar.js.
This the Vue.js code
import ProgressBar from 'progressbar.js'
var bar;
export default {
data() {
return {
fitness: ['Run', 'Cycle'],
val: 0.65
}
},
mounted(){
this.showProgressBar(this.val);
},
created: function() {
},
methods:{
showProgressBar: function(val){
new ProgressBar.Circle('#container',{
trailColor: 'gainsboro',
trailWidth: 20,
color: 'teal',
strokeWidth: 20
}).animate(val);
}
}
}
<div class="content" v-for="fitness in fitness">
<span>{{ fitness }}</span>
<div id="container"></div>
</div>
Since an id is associated with only one div, I am not able to execute a new ProgressBar.Circle object that would create another div. Is there a way to dynamically create a new div with different a id inside the v-for every time the new ProgressBar.circle is executed? Can somenone please help me out here?