您好,登錄后才能下訂單哦!
這篇“微信小程序如何實現(xiàn)左側(cè)導(dǎo)航欄”文章的知識點大部分人都不太理解,所以小編給大家總結(jié)了以下內(nèi)容,內(nèi)容詳細(xì),步驟清晰,具有一定的借鑒價值,希望大家閱讀完這篇文章能有所收獲,下面我們一起來看看這篇“微信小程序如何實現(xiàn)左側(cè)導(dǎo)航欄”文章吧。
wxml
<view class="content"> <view class='left'> <view class="{{flag==0?'select':'normal'}}" id='0' bindtap='switchNav'>8:00-9:00</view> <view class="{{flag==1?'select':'normal'}}" id='1' bindtap='switchNav'>9:00-10:00</view> <view class="{{flag==2?'select':'normal'}}" id='2' bindtap='switchNav'>14:00-15:00</view> <view class="{{flag==3?'select':'normal'}}" id='3' bindtap='switchNav'>15:00-16:00</view> </view> <view class='right'> <view class='category'> <swiper current='{{currentTab}}' style='height:500px' vertical="{{true}}"> <swiper-item id='0' catchtouchmove="stopTouchMove"> 專家A </swiper-item> <swiper-item id='1' catchtouchmove="stopTouchMove"> 專家B </swiper-item> <swiper-item id='2' catchtouchmove="stopTouchMove"> 專家C </swiper-item> <swiper-item id='3' catchtouchmove="stopTouchMove"> 專家D </swiper-item> </swiper> </view> </view> </view>
wxss
.content { display: flex; flex-direction: row; font-family: "Microsoft YaHei" } .left { width: 30%; font-size: 10px; height: 500px; background-color: #F4F4F4; } .left view { text-align: center; height: 45px; line-height: 45px; } .select { background-color: #ffffff; border-left: 2px solid #36AE66; font-weight: bold; color: #36AE66; } .normal { background-color: #F4F4F4; border-bottom: 1px solid #f2f2f2; } .right { width: 70%; margin: 0px; }
js
Page({ data: { flag: 0, currentTab: 0 }, switchNav: function(e) { var page = this; var id = e.target.id; if (this.data.currentTab == id) { return false; } else { page.setData({ currentTab: id }); } page.setData({ flag: id }); }, catchTouchMove: function (res) { return false } })
實現(xiàn)效果
以上就是關(guān)于“微信小程序如何實現(xiàn)左側(cè)導(dǎo)航欄”這篇文章的內(nèi)容,相信大家都有了一定的了解,希望小編分享的內(nèi)容對大家有幫助,若想了解更多相關(guān)的知識內(nèi)容,請關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。