### [关于微信小程序中顶部导航栏的实现](https://www.prosaas.cn/article/17335) **Published:** 2018-06-26T09:01:18 **Author:** 5201314 **Excerpt:** 这篇文章主要介绍了微信小程序中顶部导航栏的实现代码的相关资料,需要的朋友可以参考下微信小程序中顶部导航栏的实现… 这篇文章主要介绍了微信小程序中顶部导航栏的实现代码的相关资料,需要的朋友可以参考下 **微信小程序中顶部导航栏的实现** **实例代码:** 11 22 33 44 55 我是哈哈 我是呵呵 我是嘿嘿 我是嘿嘿 我是嘿嘿 .swiper-tab{ width: 100%; border-bottom: 2rpx solid #777777; text-align: center; line-height: 80rpx; } .swiper-tab-list{ font-size: 30rpx; display: inline-block; width: 20%; color: #777777; } .on{ color: #da7c0c; border-bottom: 5rpx solid #da7c0c;} .swiper-box{ display: block; height: 100%; width: 100%; overflow: hidden; } .swiper-box view{ text-align: center; } var app = getApp() Page( { data: { /\*\* \* 页面配置 \*/ winWidth: 0, winHeight: 0, // tab切换 currentTab: 0, }, onLoad: function() { var that = this; /\*\* \* 获取系统信息 \*/ wx.getSystemInfo( { success: function( res ) { that.setData( { winWidth: res.windowWidth, winHeight: res.windowHeight }); } }); }, /\*\* \* 滑动切换tab \*/ bindChange: function( e ) { var that = this; that.setData( { currentTab: e.detail.current }); }, /\*\* \* 点击tab切换 \*/ swichNav: function( e ) { var that = this; if( this.data.currentTab === e.target.dataset.current ) { return false; } else { that.setData( { currentTab: e.target.dataset.current }) } }, /\*\* \* 点击分享 \*/ onShareAppMessage: function () { return { title: '装逼小程序', path: '/page/user?id=123' } } }) 以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网! 相关推荐: 微信小程序中tabBar底部导航的介绍 微信小程序实现城市列表的选择 以上就是关于微信小程序中顶部导航栏的实现的详细内容,更多请关注知企PROSAAS其它相关文章! **Categories:** 后端开发 ---