当前位置:网站首页>滑块视图的实现
滑块视图的实现
2022-06-23 03:53:00 【richest_qi】
小程序项目
代码涉及的文件有
- app.json
- pages/index/index.wxml
- pages/index/index.wxss
- static/images(小程序根目录下新建目录:static,static新建子目录:images,用于存放静态图片)

app.json
{
"pages":[
"pages/index/index"
],
"window":{
"navigationBarBackgroundColor": "#1c424d",
"navigationBarTitleText": "AITO",
"navigationBarTextStyle":"white"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
pages/index/index.wxml
<view class="container">
<scroll-view class="list" enable-flex scroll-x>
<view class="item">
<image src="/static/images/aito-m5.jpg"></image>
<text>AITO 问界M5,行无界,智千里</text>
</view>
<view class="item">
<image src="/static/images/m5.jpg"></image>
<text>先锋首秀,上演智能的豪华</text>
</view>
<view class="item">
<image src="/static/images/aito-wenjie-m5.jpg"></image>
<text>天生好强,只为自由驰骋。高手起步,远近都在行</text>
</view>
<view class="item">
<image src="/static/images/m7.jpg"></image>
<text>问界M7,豪华智慧大型电动SUV</text>
</view>
<view class="item">
<image src="/static/images/aito.jpg"></image>
<text>AITO,以优雅姿态驾驭更多活力</text>
</view>
</scroll-view>
</view>
pages/index/index.wxss
.container{
padding: 20rpx;
}
.list{
display: flex;
}
.item{
width: 200rpx;
margin-right: 20rpx;
}
.item image{
width: 200rpx;
height: 112rpx;
border-radius: 10rpx;
}
.item text{
font-size: 26rpx;
/* 多行文本溢出,省略号代替 */
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
scroll-view组件
scroll-view可实现一个可滚动的视图区域。
scroll-view 组件有很多属性,常用的有:
enable-flex,是否启用flex布局,只有启用,display:flex才会生效。布尔值,默认是false,即默认不启用flex布局。scroll-x,是否允许横向滚动。布尔值,默认是false,即默认不允许横向滚动。
边栏推荐
- centos7部署docker,安装mysql
- ICer技能02makefile脚本自跑vcs仿真
- ApiPost接口测试的用法之------Post
- Flask Foundation: environment setup + configuration + mapping between URL and attempt + redirection + database connection
- Examples of corpus data processing cases (part of speech encoding, part of speech restoration)
- 实战| 记一次借Viper来多重内网渗透
- Abnova acid phosphatase (wheat germ) instructions
- Parameter passing of 18 generator function
- Actual combat | multiple intranet penetration through Viper
- Experience of Tencent cloud installed by Kali
猜你喜欢

Object structure diagram, which can quickly illustrate the internal structure of an object

gson TypeAdapter 适配器

DO280OpenShift命令及故障排查--常见故障排除和章节实验

Mini Homer——几百块钱也能搞到一台远距离图数传链路?

Official download and installation of QT and QT vs tools plug-ins

Dsp7 environment

Chrome debugging tips

美团好文:从预编译的角度理解Swift与Objective-C及混编机制

Meituan's good article: understand swift, Objective-C and the mixing mechanism from the perspective of precompiling

dolphinscheduler 2.0.5 任务测试(spark task)报错:Container exited with a non-zero exit code 1
随机推荐
2 万字 + 20张图|细说 Redis 九种数据类型和应用场景
Mini Homer - can you get a remote map data transmission link for hundreds of yuan?
A mvc5+easyui enterprise rapid development framework source code BS framework source code
VGg Chinese herbal medicine identification
如何更好地组织最小 WEB API 代码结构
聊聊 C# 中的 Composite 模式
ICER skills 03design compile
How to solve multi-channel customer communication problems in independent stations? This cross-border e-commerce plug-in must be known!
An understanding of free() (an error in C Primer Plus)
Can bus Basics
Function declaration and call of 17 generator
openwrt目录结构
Banner banner
七年码农路
Pads and flash symbols in cadence
Abnova liquidcell negative enrichment cell separation and recovery system
ZK has a node reporting it is possible not running and the log has no obvious error
Const understanding one
MySQL import large files (can be millions or hundreds)
OGNL Object-Graph Navigation Language