类似于 HTML 中的 div,是一个块级元素。常用来实现页面的布局效果。
.wxml中:
A
B
C
.wxss中:
.container1 view {
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
}
.container1 view:nth-child(1) {
background-color: lightgreen;
}
.container1 view:nth-child(2) {
background-color: lightskyblue;
}
.container1 view:nth-child(3) {
background-color: lightcoral;
}
.container1 {
display: flex;
justify-content: space-around;
}
常用来实现滚动列表效果。
scroll-y属性:允许纵向滚动
scroll-x属性:允许横向滚动
.wxml中:
A
B
C
.wxss中:
.container1 {
border: 1px solid red;
/*给scroll-view固定高度*/
height: 120px;
width: 100px;
}
A
B
C
files.wxss中:
.swiper-container {
height: 150px;
}
.item {
height: 100%;
line-height: 150px;
text-align: center;
}
swiper-item:nth-child(1) .item {
background-color: lightgreen;
}
swiper-item:nth-child(2) .item {
background-color: lightskyblue;
}
swiper-item:nth-child(3) .item {
background-color: lightcoral;
}
类似于 HTML 中的 span 标签,是一个行内元素。
.wxml中:
手机号支持长按选中效果
13770565678
支持把 HTML 字符串渲染为 WXML 结构。
.wxml中:
功能比 HTML 中的 button 按钮丰富,通过 open-type 属性可以调用微信提供的各种功能(客服、转发、获取用户授权、获取用户信息等)。
.wxml中:
image 组件默认宽度约 300px、高度约 240px。
.wxml中:
.wxss中:
image {
border: 2px solid blue ;
}