当前位置:网站首页>常用的视图容器类组件
常用的视图容器类组件
2022-07-05 20:19:00 【'wx】
1view
普通视图区域
类似于html中的div,是一个块级元素
常用来实现页面的布局效果
<view>
我是view
</view>
2.scroll-view
可滚动的视图区域
常用来实现滚动列表效果
<scroll-view class="container" scroll-y>
<view>A</view>
<view>B</view>
<view>C</view>
</scroll-view>
3.swiper和swiper-item
轮播图容器组件和轮播图item组件
<swiper class="swiper-container" indicator-dots="true" indicator-color="pink" indicator-active-color="orange" autoplay interval="1000" circular="true">
<swiper-item>
<view class="item">item1</view>
</swiper-item>
<swiper-item>
<view class="item">item2</view>
</swiper-item>
<swiper-item>
<view class="item">item3</view>
</swiper-item>
</swiper>
swiper组件常用属性
属性 | 类型 | 默认值 | 说明 |
indicator-dots | boolean | false | 是否显示面板指示点 |
indicator-color | color | rgba(0, 0, 0, .3) | 指示点颜色 |
indicator-active-color | color | #000000 | 当前选中的指示点颜色 |
autoplay | boolean | false | 是否自动切换 |
interval | number | 5000 | 自动切换时间间隔 |
circular | boolean | false | 是否采用衔接滑动 |
4.text 文本组件
类似于 HTML 中的 span 标签,是一个行内元素
通过 text 组件的 selectable 属性,实现长按选中文本内容的效果
5.rich-text 富文本组件
支持把 HTML 字符串渲染为 WXML 结构
通过 rich-text 组件的 nodes 属性节点,把 HTML 字符串渲染为对应的 UI 结构
6.button
按钮组件
功能比html中的button按钮丰富
通过open-type属性可以调用微信提供的各种功能(客服,转发,获取用户授权,获取用户信息等)
7.image
图片组件
image组件默认宽度约300px,高度约200px
image的mode属性用来指定图片的裁剪和缩放模式,常用的mode属性值如下
mode 值 | 说明 |
scaleToFill | (默认值)缩放模式,不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素 |
aspectFit | 缩放模式,保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说, 可以完整地将图片显示出来。 |
aspectFill | 缩放模式,保持纵横比缩放图片,只保证图片的短边能完全显示出来。也就是说, 图片通常只在水平或垂直方向是完整的,另一个方向将会发生截取。 |
widthFix | 缩放模式,宽度不变,高度自动变化,保持原图宽高比不变 |
heightFix | 缩放模式,高度不变,宽度自动变化,保持原图宽高比不变 |
8.navigator
页面导航组件
类似于html中的a标签
边栏推荐
- Is it safe for Galaxy Securities to open an account online?
- Parler de threadlocal insecurerandom
- Is it safe for CICC fortune to open an account online?
- leetcode刷题:二叉树10(完全二叉树的节点个数)
- model方法
- mongodb文档间关系
- About the priority of Bram IP reset
- Rainbond 5.7.1 支持对接多家公有云和集群异常报警
- 本季度干货导航 | 2022年Q2
- CCPC 2021威海 - G. Shinyruo and KFC(组合数,小技巧)
猜你喜欢
Go language | 02 for loop and the use of common functions
leetcode刷题:二叉树18(最大二叉树)
CTF reverse Foundation
全国爱眼教育大会,2022第四届北京国际青少年眼健康产业展会
计算lnx的一种方式
kubernetes资源对象介绍及常用命令(五)-(ConfigMap&Secret)
解决php无法将string转换为json的办法
leetcode刷题:二叉树15(找树左下角的值)
[quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)
PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
随机推荐
Process file and directory names
信息学奥赛一本通 1337:【例3-2】单词查找树 | 洛谷 P5755 [NOI2000] 单词查找树
鸿蒙系统控制LED的实现方法之经典
Go language learning tutorial (XV)
leetcode刷题:二叉树15(找树左下角的值)
Scala basics [HelloWorld code parsing, variables and identifiers]
关于BRAM IP复位的优先级
【愚公系列】2022年7月 Go教学课程 004-Go代码注释
document方法
【数字IC验证快速入门】3、数字IC设计全流程介绍
【数字IC验证快速入门】2、通过一个SoC项目实例,了解SoC的架构,初探数字系统设计流程
14. Users, groups, and permissions (14)
July 4, 2022 - July 10, 2022 (UE4 video tutorial MySQL)
淺淺的談一下ThreadLocalInsecureRandom
Debezium series: modify the source code to support UNIX_ timestamp() as DEFAULT value
Go language | 02 for loop and the use of common functions
[Yugong series] go teaching course in July 2022 004 go code Notes
Notes on key vocabulary in the English original of the biography of jobs (12) [chapter ten & eleven]
- Oui. Net Distributed Transaction and Landing Solution
【数字IC验证快速入门】1、浅谈数字IC验证,了解专栏内容,明确学习目标