服务页面实现截图如下
wxml文件
<view>
<view>
<view class="weui-search-bar">
<view class="weui-search-bar__form">
<!-- 搜索框 -->
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<input type="text" class="weui-search-bar__input" placeholder="请输入搜索内容"/>
</view>
</view>
<!-- 搜索按钮,调用搜索查询方法 -->
<view class="weui-search-bar__cancel-btn" bindtap='方法名a'>搜索</view>
</view>
</view>
<view class='mowei'>
<view class='wodedingdan'>
<image src='../imag/fengche.png'></image>
<view class='ziti'>战友动态</view>
</view>
<view class='wodedingdan'>
<image src='../imag/location.png'></image>
<view class='ziti'>附近战友</view>
</view>
<view class='wodedingdan'>
<image src='../imag/club.png'></image>
<view class='ziti'>战友部落</view>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/intnet.png"></image>
<text class="txt1">互联网+创业项目</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/skills.png"></image>
<text class="txt1">职业技能培训</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/policy.png"></image>
<text class="txt1">政策解读通道</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/wangted.png"></image>
<text class="txt1">就业招聘</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/imbark.png"></image>
<text class="txt1">自主创业</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/commonwealth.png"></image>
<text class="txt1">军旅公益</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/fund.png"></image>
<text class="txt1">战友基金</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/league.png"></image>
<text class="txt1">军盟</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/market.png"></image>
<text class="txt1">战友商城</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
<view class="menu">
<view class="menu-child">
<image class="menu-image" src="../imag/soldier.png"></image>
<text class="txt1">爱迷彩服务</text>
<image class="right-arrow" src="../imag/right-arrow.png"></image>
</view>
</view>
</view>
wxss文件
.weui-search-bar {
position: relative;
padding: 8px 10px;
display: -webkit-box;
display: -webkit-flex;
display: flex;
box-sizing: border-box;
background-color: #EFEFF4;
border-top: 1rpx solid #D7D6DC;
border-bottom: 1rpx solid #D7D6DC;
}
.weui-icon-search_in-box {
position: absolute;
left: 10px;
top: 7px;
}
.weui-search-bar__form {
position: relative;
-webkit-box-flex: 1;
-webkit-flex: auto;
flex: auto;
border-radius: 5px;
background: #FFFFFF;
border: 1rpx solid #E6E6EA;
}
.weui-search-bar__box {
position: relative;
padding-left: 30px;
padding-right: 30px;
width: 100%;
box-sizing: border-box;
z-index: 1;
}
.weui-search-bar__input {
height: 28px;
line-height: 28px;
font-size: 14px;
}
.weui-search-bar__cancel-btn {
margin-left: 10px;
line-height: 28px;
color: #09BB07;
white-space: nowrap;
}
.mowei {
display: flex;
width: 100%;
/* margin-left: 20rpx;
margin-right: 20rpx; */
font-size: 32rpx;
margin-top: 50rpx;
}
.wodedingdan {
width: 130rpx;
text-align: center;
font-size: 13px;
flex-grow: 1; /* 均匀分布属性 */
}
.wodedingdan image {
width: 70rpx;
height: 70rpx;
}
.ziti {
margin-top: 10rpx;
}
.menu {
height: 40px;
display: flex;
align-items: center;
margin-top: 7px;
background-color: #EFEFF4;
border-radius: 8px;
position: relative; /*父元素设置为相对位置*/
}
.right-arrow{
height: 18px;
width: 18px;
right: 15px;
position: absolute; /*让图片靠右距离5px,子元素设置为position:absolute,父元素设置为position:relative*/
}
.menu-image {
width: 30px;
height: 30px;
margin: 4px;
}
.txt1 {
align-items:center;
margin-left: 5px;
font-size: 12px;
}
.menu-child{
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
总结:用到的几个重要的属性
display:flex; 将对象作为弹性伸缩盒显示,无需考虑不同浏览的兼容问题。
flex-direction:row; 主轴为水平方向,起点在左端。
align-items:center; 定义项目在交叉轴上如何对齐,center表示中轴线对齐。
justify-content:cneter; 定义了多根轴线的对齐方式。如果项目只有一根轴线,该属性不起作用。
flex-grow:1; /*均匀分布*/
动态点击事件等待后续更新完成,目前还在构思各个功能模块的页面,敬请等待,麻烦大家点赞收藏,给点意见,谢谢啦!
太腻害了