I am in the process of creating a website and I am looking for a way to manage my styles through Vue.
I want to be able to utilize CSS with Vue, as the style of .skill-bar
serves as the background of the bar, while .skill-bar-fill
represents the green fill whose width is dependent on a number defined in Vue:
https://i.sstatic.net/TeZLs.png
In essence, how can I dynamically change the style of .skill-bar-fill
by simply adjusting the number in Vue? Is it possible to adjust the width
of each .skill-bar-fill
independently for different items?
HTML
<div class="w-100 skill-bar">
<div class=" skill-bar-fill"> {{ programming.item1}} %</div>
</div>
CSS
.skill-bar{
text-align: center;
color: $black;
font-size: 0.75rem;
height: 1rem;
background: $bg-light;
border-radius: 1rem;
}
.skill-bar-fill{
height: 1rem;
background: $green;
border-radius: 1rem;
}
Vue
export default {
name: 'Items',
data() {
return{
programming: {item1: 95, item2: 90, },
}
}
}
These are the challenges I am currently tackling.