直接上代码:
1 <div v-for="(item,i) in colorList" :key="i"> 2 <div class="cmn-color"> 3 <div :style="{'background':item}"></div><span>开发{{i+1 }}</span> 4 </div> 5 </div>
const colorList = ref(['rgb(102, 152, 255)','rgb(57, 215, 144)',"rgb(160, 161, 254)","rgb(248, 136, 121)","rgb(103, 244, 228)","rgb(65, 223, 255)"])
效果如下
标签:vue,元素,rgb,循环,数组,255 From: https://www.cnblogs.com/xuwupiaomiao/p/17719972.html