极乐门资源网 Design By www.ioogu.com

微信小程序 flex实现导航实例详解

微信小程序 flex实现导航实例详解

实现示意:

微信小程序 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; 
} 

 感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

标签:
微信小程序,flex实现导航,微信小程序,导航

极乐门资源网 Design By www.ioogu.com
极乐门资源网 免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
极乐门资源网 Design By www.ioogu.com

评论“微信小程序 flex实现导航实例详解”

暂无微信小程序 flex实现导航实例详解的评论...