I've been attempting to create something similar to the image using Vue, but I'm struggling with resizing the div elements.
Group of Circles:
Vue Warning:
Error in mounted hook: "TypeError: Cannot read property 'style' of undefined
I also tried using
el.setAttribute("style", "top: px; bottom: px;...")
, but encountered errors with the setAttribute()
method.
<template>
<div class="wavyCircles">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
</template>
computed: {
circleSizing() {
let circles = document.getElementsByClassName("circle")
for (let i = 0; i <= circles.length; i++) {
circles[i].style.top = 10 * (i + 1)
circles[i].style.bottom = 10 * (i + 1)
circles[i].style.left = 10 * (i + 1)
circles[i].style.left = 10 * (i + 1)
}
}
},
mounted: function() {
this.circleSizing();
}