当前位置:网站首页>ionic4学习笔记11-某东项目热门商品展示
ionic4学习笔记11-某东项目热门商品展示
2022-07-21 11:37:00 【tongle_deng】
1、创建热门商品图片展示列表
<!--热门商品
[ngStyle]="{'width': hotListWidth}":动态绑定样式,从后台ts传递;hotListWidth和后台变量名称一致;
*ngFor="let item of hotList" :循环从后台传递过来的hotList
-->
<div class="h_title">
猜你喜欢
</div>
<div class="hotlist">
<ul class="clearfix" [ngStyle]="{'width': hotListWidth}">
<li *ngFor="let item of hotList">
<img [src]="item.pic" />
<p>{
{item.title}}</p>
</li>
</ul>
</div>
2、数据来源
2.1 热门商品图片放在src/assets下
2.2 热门商品ts数据代码
//热门商品
public hotList:any[]=[];
public hotListWidth:any=400;
constructor(){
//热门图片数据来源
for(var i=1;i<=7;i++){
this.hotList.push({
pic:'assets/0'+i+'.jpg',
title:'第'+i+'个',
})
}
//计算hotListWidth的宽度
this.hotListWidth=this.hotList.length*9+'rem';
}
3. CSS样式:
//猜你喜欢文字的样式
.h_title{
padding: 1rem .5rem;
font-size: 1.4rem;
&::before{
display: inline-block;
border-left: 3px solid #f53d3d;
height: 14px;
width: 1px;
content: "";
top: 2px;
position: relative;
}
}
//热门商品的图片样式
.hotlist{
width: 100%;
height: 10rem;
overflow-x: auto;
overflow-y: hidden;//hostlist外层样式设置结束
ul{//hostlist内层样式开始
// width: 120rem; 动态宽度
li{
width: 8rem; //8rem=80px;
height:10rem;
float: left;
margin-left: 1rem;
img{
width: 7rem;
height: 7rem;
}
p{
padding: .4rem;
text-align: center;
}
}
}
}
4、去掉ul标签样式的css,放在global.css下
ul,ol{
list-style-type: none;
}
边栏推荐
- [CCF CSP] 201609-1 maximum fluctuation
- 首发!这份字节大佬亲码算法面试大厂进阶宝典,让你轻松刷爆LeetCode!
- 12306 ticket grabbing artifact
- vmvare虚拟机的导入与导出(ova格式)
- Why do Internet manufacturers love to "deliver takeout"?
- 即时零售三国杀:美团补仓、阿里协同、京东引流
- Thesis reading: ctrl: a conditional transformer language model for controllable generation
- 判断是否二叉搜索树
- 神牛TT685C闪光灯ETTL模式不同步解决方案
- LSTM的巅峰理解笔记
猜你喜欢
DDD - Domain service, Application Service and dto Practice Based on ABP
论文阅读:A Large-Scale Chinese Short-Text Conversation Dataset(CDial-GPT)
Xlnet learning: Research Summary
Why do Internet manufacturers love to "deliver takeout"?
Binary search tree and bidirectional linked list
情人节礼物------用她的照片和我们的聊天记录生成词云~
Relative entropy, information entropy and cross entropy
Shell loop
论文阅读:CTRL: A CONDITIONAL TRANSFORMER LANGUAGE MODEL FOR CONTROLLABLE GENERATION
The highest state of pulling wool, liberate your hands
随机推荐
LSTM的巅峰理解笔记
Xlnet learning: Research Summary
快速判断一个文件是否有病毒
鼠标点击网页任意地方都是光标闪烁输入状态
编码gbk的不可映射字符
无锡对全市必胜客门店开展食品安全隐患大排查
.replaceWith()只能工作一次
使用sql批量修改MacOs照片应用(Photos)上的照片时间
VAD simple summary
基于ABP实现DDD--领域服务、应用服务和DTO实践
nexus管理页面上传jar,jar可以被正常拉取到项目,使用idea lifecycle的deploy发布的jar只能拉取到pom,401问题
Determine whether binary search tree
【综合笔试题】难度 3.5/5,多解法热门二叉树笔试题
如何在gdb里打印unicode 16(utf-16) C#的字符串
Musk claims to be on the brain. Is it science or deception?
Import and export of vmvare virtual machine (OVA format)
ArgoCD 用户管理、RBAC 控制、命令行登录、App 同步
Judge whether it is a complete binary tree
测试:综合布线
声学术语记录