I want to change the 5 star category of a FontAwesome icon from regular to solid based on a numeric variable level
that changes from 0
to
5代码>
<template> <div id="five-stars"> <font-awesome-icon icon="fa-solid fa-star" size="6x"/> <font-awesome-icon icon="fa-regular fa-star" size="6x"/> <font-awesome-icon icon="fa-regular fa-star" size="6x"/> <font-awesome-icon icon="fa-regular fa-star" size="6x"/> <font-awesome-icon icon="fa-regular fa-star" size="6x"/> </div> </template> <script> export default { name: "ThreeScene", data() { return { level: 1 }; } }
Can you tell me how to do this without repeating
Use v-for loop
Please note that the variable
level
will start with the value1
, not0
.fa-${i Help you: