当前位置:网站首页>v-for遍历元素样式失效
v-for遍历元素样式失效
2022-07-07 22:38:00 【小白目】
要实现一下效果布局:
对于多个盒子并排,通常会用到flex布局,css如下:
.friends {
display: flex;
justify-content: space-between;
padding-top: 3.41rem;
padding-left: 0.73rem;
width: 6.1rem;
.item {
overflow-x: scroll;
.photo {
width: 1.2rem;
height: 1.2rem;
}
.name {
width: 1.13rem;
height: 0.39rem;
}
}
}
关键是给谁设置 display:flex !!
结构错误写法:给v-for那层的盒子加样式
<div>
<div
class="friends"
v-for="(item,index) of friends"
:key="index"
>
<div class="item">
<div
v-image.normal="item.photo"
class="photo"
/>
<div class="name">
{
{ item.name }}
</div>
</div>
</div>
</div>
结构正确写法:在v-for外层再套一个盒子设置样式
<div class="friends">
<div
v-for="(item,index) of friends"
:key="index"
>
<div class="item">
<div
v-image.normal="item.photo"
class="photo"
/>
<div class="name">
{
{ item.name }}
</div>
</div>
</div>
</div>
边栏推荐
- Visual Studio Deployment Project - Create shortcut to deployed executable
- Open display PDF file in web page
- paddle一个由三个卷积层组成的网络完成cifar10数据集的图像分类任务
- Is 35 really a career crisis? No, my skills are accumulating, and the more I eat, the better
- 应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
- 他们齐聚 2022 ECUG Con,只为「中国技术力量」
- Database query - what is the highest data?
- Notice on organizing the second round of the Southwest Division (Sichuan) of the 2021-2022 National Youth electronic information intelligent innovation competition
- 玩转Sonar
- 接口测试进阶接口脚本使用—apipost(预/后执行脚本)
猜你喜欢
Installation and configuration of sublime Text3
Detailed explanation of interview questions: the history of blood and tears in implementing distributed locks with redis
After going to ByteDance, I learned that there are so many test engineers with an annual salary of 40W?
某马旅游网站开发(对servlet的优化)
华为交换机S5735S-L24T4S-QA2无法telnet远程访问
Daily question brushing record (16)
Tencent security released the white paper on BOT Management | interpreting BOT attacks and exploring ways to protect
浪潮云溪分布式数据库 Tracing(二)—— 源码解析
【編程題】【Scratch二級】2019.12 飛翔的小鳥
关于组织2021-2022全国青少年电子信息智能创新大赛西南赛区(四川)复赛的通知
随机推荐
How to put recyclerview in nestedscrollview- How to put RecyclerView inside NestedScrollView?
Handwriting a simulated reentrantlock
动态库基本原理和使用方法,-fPIC 选项的来龙去脉
Prompt configure: error: required tool not found: libtool solution when configuring and installing crosstool ng tool
Solution to the problem of unserialize3 in the advanced web area of the attack and defense world
接口测试进阶接口脚本使用—apipost(预/后执行脚本)
What is load balancing? How does DNS achieve load balancing?
C language 005: common examples
Robomaster visual tutorial (0) Introduction
80% of the people answered incorrectly. Does the leaf on the apple logo face left or right?
Su embedded training - day4
Huawei switch s5735s-l24t4s-qa2 cannot be remotely accessed by telnet
搭建ADG过程中复制报错 RMAN-03009 ORA-03113
玩轉Sonar
The difference between get and post
35岁真就成了职业危机?不,我的技术在积累,我还越吃越香了
[programming problem] [scratch Level 2] December 2019 flying birds
Open display PDF file in web page
Emotional post station 010: things that contemporary college students should understand
Play sonar