view介绍
view类似于HTML中的div标签是最基础的UI组件,一般使用view标签来进行页面内容的区块划分。
view本身没有任何样式,全部需要通过CSS来手动定义
案例
wxml代码
<view class="red" >
<view class="green">green</view>
<view class="blue">blue</view>
</view>
<view class="orange">orange</view>
wxss代码
.red{
width: 100%;
background-color: red;
}
.green{
width: 100px;
height: 100px;
background-color: green;
}
.blue{
width: 100px;
height: 100px;
background-color: blue;
}
.orange{
width: 100%;
height: 100px;
background-color: orange;
}
微信开发者工具结果展示
当然view组件还有其他的属性,读者可以自行尝试使用