当前位置:网站首页>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>边栏推荐
- Is Zhou Hongyi, 52, still young?
- 从服务器到云托管,到底经历了什么?
- 52歲的周鴻禕,還年輕嗎?
- [the most detailed in history] statistical description of overdue days in credit
- Summary of the third course of weidongshan
- 52岁的周鸿祎,还年轻吗?
- STM32F1与STM32CubeIDE编程实例-旋转编码器驱动
- 华泰证券官方网站开户安全吗?
- 3 years of experience, can't you get 20K for the interview and test post? Such a hole?
- 詹姆斯·格雷克《信息简史》读后感记录
猜你喜欢

1293_ Implementation analysis of xtask resumeall() interface in FreeRTOS

C language 001: download, install, create the first C project and execute the first C language program of CodeBlocks
![Cause analysis and solution of too laggy page of [test interview questions]](/img/8d/3ca92ce5f9cdc85d52dbcd826e477d.jpg)
Cause analysis and solution of too laggy page of [test interview questions]

大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?

华为交换机S5735S-L24T4S-QA2无法telnet远程访问

fabulous! How does idea open multiple projects in a single window?

某马旅游网站开发(对servlet的优化)

第一讲:链表中环的入口结点

Detailed explanation of interview questions: the history of blood and tears in implementing distributed locks with redis

80% of the people answered incorrectly. Does the leaf on the apple logo face left or right?
随机推荐
Deep dive kotlin synergy (XXII): flow treatment
韦东山第二期课程内容概要
Leetcode brush questions
paddle一个由三个卷积层组成的网络完成cifar10数据集的图像分类任务
Summary of the third course of weidongshan
从服务器到云托管,到底经历了什么?
[the most detailed in history] statistical description of overdue days in credit
Single machine high concurrency model design
接口测试进阶接口脚本使用—apipost(预/后执行脚本)
The difference between -s and -d when downloading packages using NPM
Cmake learning notes (1) compile single source programs with cmake
深潜Kotlin协程(二十三 完结篇):SharedFlow 和 StateFlow
[programming problem] [scratch Level 2] draw ten squares in December 2019
[programming problem] [scratch Level 2] 2019.09 make bat Challenge Game
[basis of recommendation system] sampling and construction of positive and negative samples
Reading notes 004: Wang Yangming's quotations
Notice on organizing the second round of the Southwest Division (Sichuan) of the 2021-2022 National Youth electronic information intelligent innovation competition
What if the testing process is not perfect and the development is not active?
How to add automatic sorting titles in typora software?
RPA cloud computer, let RPA out of the box with unlimited computing power?