一.分析计算机页面布局
zy1.wxml:
<view class="content">
<view class="top">
<view class="screen">3x8</view>
</view>
<view class="buttom">
<view class="btn">
<view class="item orange">C</view>
<view class="item orange">←</view>
<view class="item orange">#</view>
<view class="item orange">+</view>
</view>
<view class="btn">
<view class="item blue">9</view>
<view class="item blue">8</view>
<view class="item blue">7</view>
<view class="item orange">-</view>
</view>
<view class="btn">
<view class="item blue">6</view>
<view class="item blue">5</view>
<view class="item orange">4</view>
<view class="item orange">x</view>
</view>
<view class="btn">
<view class="item blue">3</view>
<view class="item blue">2</view>
<view class="item blue">1</view>
<view class="item orange">÷</view>
</view>
<view class="btn">
<view class="item blue zero">0</view>
<view class="item blue">.</view>
<view class="item orange">=</view>
</view>
</view>
</view>
zy1.wxss:
.top{
width: 100%;
margin-bottom: 30rpx;
}
.bottom{
width: 100%;
}
.screen{
text-align: right;
width: 100%;
line-height: 130rpx;
padding: 0 10rpx;
font-weight: bold;
font-size: 60px;
box-sizing: border-box;
border-top: 1px solid #fff;
}
.btn{
display: flex;
flex-direction: row;
flex: 1;
width: 100%;
height: 4rem;
background-color: #fff;
}
.item{
width: 25%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
margin-top: 1px;
margin-right: 1px;
}
.zero{
width: 50%;
}
.orange{
color: #fef4e9;
background: #f78d1d;
font-weight: bold;
}
.blue{
color: #d9eef7;
background-color: #0095cd;
}
app.json:
{
"pages": [
"pages/zy1/zy1"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "计算机",
"navigationBarBackgroundColor": "#cccccc"
},
"style": "v2",
"componentFramework": "glass-easel",
"lazyCodeLoading": "requiredComponents"
}
效果图:
二.类似淘宝页面布局
zy2.wxml:
<view class="integrity">
<view class="tp">
<view class="ith">
行业趋势指南 V
</view>
<view class="ith">
年度趋势指南 V
</view>
</view>
<view class="er">
<view class="gh">最新发布</view>
<view class="gh1" style="text-align: center;" > 单品</view>
<view class="gh1" style="text-align: center;" >色彩</view>
<view class="gh1" style="text-align: center;" >风格</view>
<view class="gh1" style="text-align: center;" >细节</view>
<view class="gh1" style="text-align: center;" >面料</view>
</view>
<view class="ys1">
<view class="fd1"></view>
<view class="fd1"></view>
</view>
<view class="ys">
<view class="fd2"></view>
<view class="fd2"></view>
</view>
<view class="ys">
<view class="fd3"></view>
<view class="fd3"></view>
</view>
</view>
zy2.wxss:
.integrity{
padding: 10px;
width: 400px;
}
.tp{
display: flex;
flex-direction: row;
text-align:center;
font-size: 15px;
width: 300px;
height: 30px;
border-bottom: 1px solid #ccc;
}
.ith{
width: 150px;
margin-right: 10px;
}
.er{
display: flex;
flex-direction: row;
width: 300px;
text-align:center;
margin-top: 6px;
height: 20px;
border-bottom: 1px solid #ccc;
}
.gh1,.gh{
width:50px;
font-size: 10px;
margin-left: 4px;
}
.gh{
width: 50px;
border-bottom: 2px solid black;
}
.ys1,.ys{
width: 300px;
height: 130px;
margin-top: 20px;
display: flex;
flex-direction: row;
justify-content: space-around;
}
.fd1{
width: 100px;
background-color: blanchedalmond;
border:2px solid blue;
margin-top: 20px;
}
.fd2{
width: 100px;
background-color: aqua;
border:2px solid blueviolet;
margin-top: 20px;
}
.fd3{
width: 100px;
background-color: blueviolet;
border:2px solid brown;
margin-top: 20px;
}
效果图: