当前位置:网站首页>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>边栏推荐
- 52歲的周鴻禕,還年輕嗎?
- Single machine high concurrency model design
- 华泰证券官方网站开户安全吗?
- [the most detailed in history] statistical description of overdue days in credit
- 2022-07-07:原本数组中都是大于0、小于等于k的数字,是一个单调不减的数组, 其中可能有相等的数字,总体趋势是递增的。 但是其中有些位置的数被替换成了0,我们需要求出所有的把0替换的方案数量:
- 深潜Kotlin协程(二十二):Flow的处理
- When creating body middleware, express Is there any difference between setting extended to true and false in urlencoded?
- 他们齐聚 2022 ECUG Con,只为「中国技术力量」
- Visual Studio Deployment Project - Create shortcut to deployed executable
- 应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
猜你喜欢

Binder核心API

Set up personal network disk with nextcloud

Reptile practice (VIII): reptile expression pack

1293_FreeRTOS中xTaskResumeAll()接口的实现分析

玩轉Sonar

Single machine high concurrency model design

new和delete的底层原理以及模板

C language 001: download, install, create the first C project and execute the first C language program of CodeBlocks

52岁的周鸿祎,还年轻吗?
![[研发人员必备]paddle 如何制作自己的数据集,并显示。](/img/50/3d826186b563069fd8d433e8feefc4.png)
[研发人员必备]paddle 如何制作自己的数据集,并显示。
随机推荐
[OBS] the official configuration is use_ GPU_ Priority effect is true
5G NR 系统消息
Common selectors are
Jouer sonar
第一讲:链表中环的入口结点
Introduction to paddle - using lenet to realize image classification method I in MNIST
Operating system principle --- summary of interview knowledge points
韦东山第二期课程内容概要
快速上手使用本地测试工具postman
[programming questions] [scratch Level 2] March 2019 garbage classification
Smart regulation enters the market, where will meituan and other Internet service platforms go
Robomaster visual tutorial (0) Introduction
RPA云电脑,让RPA开箱即用算力无限?
【編程題】【Scratch二級】2019.12 飛翔的小鳥
他们齐聚 2022 ECUG Con,只为「中国技术力量」
【测试面试题】页面很卡的原因分析及解决方案
ROS from entry to mastery (IX) initial experience of visual simulation: turtlebot3
Tools for debugging makefiles - tool for debugging makefiles
Flask learning record 000: error summary
哪个券商公司开户佣金低又安全,又靠谱