鸿蒙js页面布局 原创
魔法少女郭德纲
发布于 2021-1-13 14:02
浏览
3收藏
1.数据模型定义
2.页面布局hml
<div class="pageview">
<div class="topview">
<div class="topcell">
<text class="txtview">{{title}}</text>
</div>
<div class="topcell">
<text class="txtview">{{t1}}</text>
</div>
<div class="topcell">
<text class="txtview">{{t2}}</text>
</div></div>
<div class="contentview">
<div class="fbox">
<block for="{{dataarrays}}">
<div class="box">
<text>{{$item}}</text>
</div></block></div></div>
<div class="bottomview">
<text class="txtview">{{btxt}}</text>
</div></div>
3.弹性布局css
pageview{
width: 100%;
height: 1200px;;
background-color: aqua;
/**启用fiex布局**/
display: flex;
/**方向按列布局**/
flex-direction: column;}
.topview{
width: 100%;
height: 20%;
background-color: cornflowerblue;
display: flex;
/**垂直居中**/
align-items: center;
/**水平居中**/
justify-content: center;}
.contentview{
width: 100%;
height: 70%;
background-color: azure;
display:flex;
justify-content: center;
align-items: center;}
.bottomview{
width: 100%;
height: 10%;
background-color: cornflowerblue;
display: flex;
justify-content: center;
align-items: center;}
.topcell{
width: 30%;
height: 60%;
border: 4px solid deepskyblue;
margin: 10px;
border-radius: 20px;
display: flex;
justify-content: center;}
.txtview{
font-size: 50px;
color: snow;
font-weight: bold;}
.box{
width: 30%;
height: 190px;
border: 2px solid black;
display:flex;
justify-content: center;
align-items: center;
margin: 5px;
border-radius: 10px;}
.fbox{
width: 80%;
height: 71%;
background-color: deepskyblue;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
border-radius: 20px;}
4.
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
标签
已于2021-1-14 16:15:32修改
赞
2
收藏 3
回复
相关推荐
这么清丽脱俗的昵称。。。。
床前明月光,我叫郭德纲
哈哈,谢谢
举头望明月,姜昆进丐帮