当前位置:网站首页>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>
边栏推荐
- Linkedblockingqueue source code analysis - add and delete
- Detailed explanation of interview questions: the history of blood and tears in implementing distributed locks with redis
- Zhou Hongqi, 52 ans, est - il encore jeune?
- 哪个券商公司开户佣金低又安全,又靠谱
- Anaconda+pycharm+pyqt5 configuration problem: pyuic5 cannot be found exe
- Su embedded training - day4
- DNS 系列(一):为什么更新了 DNS 记录不生效?
- How can CSDN indent the first line of a paragraph by 2 characters?
- [研发人员必备]paddle 如何制作自己的数据集,并显示。
- Visual Studio Deployment Project - Create shortcut to deployed executable
猜你喜欢
Detailed explanation of interview questions: the history of blood and tears in implementing distributed locks with redis
玩轉Sonar
【编程题】【Scratch二级】2019.09 绘制雪花图案
Huawei switch s5735s-l24t4s-qa2 cannot be remotely accessed by telnet
Is Zhou Hongyi, 52, still young?
Jouer sonar
【编程题】【Scratch二级】2019.12 绘制十个正方形
Zhou Hongqi, 52 ans, est - il encore jeune?
[question de programmation] [scratch niveau 2] oiseaux volants en décembre 2019
【编程题】【Scratch二级】2019.09 制作蝙蝠冲关游戏
随机推荐
【编程题】【Scratch二级】2019.09 绘制雪花图案
手写一个模拟的ReentrantLock
爬虫实战(八):爬表情包
从服务器到云托管,到底经历了什么?
How does starfish OS enable the value of SFO in the fourth phase of SFO destruction?
A brief history of information by James Gleick
What is load balancing? How does DNS achieve load balancing?
5g NR system messages
Flask learning record 000: error summary
服务器防御DDOS的方法,杭州高防IP段103.219.39.x
Binder核心API
Notice on organizing the second round of the Southwest Division (Sichuan) of the 2021-2022 National Youth electronic information intelligent innovation competition
动态库基本原理和使用方法,-fPIC 选项的来龙去脉
Visual Studio Deployment Project - Create shortcut to deployed executable
The method of server defense against DDoS, Hangzhou advanced anti DDoS IP section 103.219.39 x
Smart regulation enters the market, where will meituan and other Internet service platforms go
Teach you to make a custom form label by hand
An error is reported during the process of setting up ADG. Rman-03009 ora-03113
智慧监管入场,美团等互联网服务平台何去何从
RPA云电脑,让RPA开箱即用算力无限?