微信小程序 flex实现导航实例详解
(编辑:jimmy 日期: 2025/11/2 浏览:3 次 )
微信小程序 flex实现导航实例详解
实现示意:
1.链接顶部内边距,留出圆形图标的位置。
2.伪元素:before绘制圆形。
3.圆形中添加图标。
4.左右外边距控制间距,及促使在需要的地方换行。
wxml:
<view class="serviceMenu"> <navigator url="http://xwbline.com/">资本</navigator> …… </view>
wxss:
.serviceMenu{
display:flex;"\20";
position:absolute;
top:0;
left:50%;
margin-left:-55rpx;
width:110rpx;
height:110rpx;
border-radius:50%;
background:#bbc1cd;
}
//设定不同图标。注意链接地址是绝对地址,因为小程序不支持相对地址的背景图。只支持image相对地址。
.serviceMenu navigator:nth-child(1):before{
background:#fc6e51 url(http://xwbline.com/icon_service_big01.png) no-repeat center center;
}
.serviceMenu navigator:nth-child(2):before{
background:#48cfad url(http://xwbline.com/icon_service_big02.png) no-repeat center center;
}
………………
如果需要字数限制的话:
text{
display:block;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
下一篇:微信扫码支付零云插件版实例详解

