码迷,mamicode.com
首页 > 其他好文 > 详细

解决排行榜前三与后面数字样式不同的方法

时间:2019-03-27 11:00:47      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:height   no-repeat   flex   nbsp   str   image   icon   ffffff   rem   

HTML中
<ul class="lists">
<li class="list-item" v-for="(item,index) in rank" :key="index">
<span class="name">
<i v-if="index < 3" class="icon" :class="`icon-rank${index}`"></i>
<i v-else class="rank-count">{{item.rank}}</i>
<em class="rank-name">{{item.name}}</em>
</span>
<span class="count">巡展{{item.time}}次</span>
</li>
</ul>
 
 
script
rank: [
{ rank: "1", name: "安尼塔", time: "18" },
{ rank: "2", name: "安尼塔", time: "18" },
{ rank: "3", name: "安尼塔", time: "18" },
{ rank: "4", name: "安尼塔", time: "18" }
{ rank: "5", name: "安尼塔", time: "18" },
 
css
.name {
display: flex;
align-items: center;
.icon {
display: inline-block;
width: rem(30);
height: rem(30);
}
.icon-rank0 {
@extend .icon;
background: url("../../images/rank_first.png") no-repeat;
background-size: 100% 100%;
}
.icon-rank1 {
@extend .icon;
background: url("../../images/rank_second.png") no-repeat;
background-size: 100% 100%;
}
.icon-rank2 {
@extend .icon;
background: url("../../images/rank_third.png") no-repeat;
background-size: 100% 100%;
}
.rank-count {
width: rem(30);
text-align: center;
font-size: 20px;
}
.rank-name {
margin-left: rem(22);
}
}
.count {
font-size: 14px;
}
 
页面
技术图片

 

解决排行榜前三与后面数字样式不同的方法

标签:height   no-repeat   flex   nbsp   str   image   icon   ffffff   rem   

原文地址:https://www.cnblogs.com/dcj2018/p/10605576.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!