小編給大家分享一下微信開發(fā)實(shí)戰(zhàn)之頂部導(dǎo)航欄的示例分析,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
需求:頂部導(dǎo)航欄
效果圖:
wxml:
<!--導(dǎo)航條--> <view class="navbar"> <text wx:for="{{navbar}}" data-idx="{{index}}" class="item {{currentTab==index ? 'active' : ''}}" wx:key="unique" bindtap="navbarTap">{{item}}</text> </view> <!--首頁--> <view hidden="{{currentTab!==0}}"> tab_01 </view> <!--搜索--> <view hidden="{{currentTab!==1}}"> tab_02 </view> <!--我--> <view hidden="{{currentTab!==2}}"> tab_03 </view>
wxss:
page{ display: flex; flex-direction: column; height: 100%; } .navbar{ flex: none; display: flex; background: #fff; } .navbar .item{ position: relative; flex: auto; text-align: center; line-height: 80rpx; } .navbar .item.active{ color: #FFCC00; } .navbar .item.active:after{ content: ""; display: block; position: absolute; bottom: 0; left: 0; right: 0; height: 4rpx; background: #FFCC00; }
js:
var app = getApp() Page({ data: { navbar: ['首頁', '搜索', '我'], currentTab: 0 }, navbarTap: function(e){ this.setData({ currentTab: e.currentTarget.dataset.idx }) } })
運(yùn)行:
看完了這篇文章,相信你對“微信開發(fā)實(shí)戰(zhàn)之頂部導(dǎo)航欄的示例分析”有了一定的了解,如果想了解更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!
網(wǎng)站標(biāo)題:微信開發(fā)實(shí)戰(zhàn)之頂部導(dǎo)航欄的示例分析-創(chuàng)新互聯(lián)
分享地址:http://aaarwkj.com/article44/dpggee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、微信公眾號、網(wǎng)站排名、網(wǎng)頁設(shè)計(jì)公司、App設(shè)計(jì)、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容