小程序如何實現(xiàn)YDUI中ScrollTab組件的示例-創(chuàng)新互聯(lián)

這篇文章主要介紹小程序如何實現(xiàn)YDUI中ScrollTab組件的示例,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!

創(chuàng)新互聯(lián)是一家專注于做網(wǎng)站、成都做網(wǎng)站與策劃設(shè)計,博羅網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十載,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:博羅等地區(qū)。博羅做網(wǎng)站價格咨詢:18982081108

                                                       這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)YDUI的ScrollTab組件,滾動選項卡效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了微信小程序?qū)崿F(xiàn)滾動選項卡效果的具體代碼,供大家參考,具體內(nèi)容如下

DEMO下載

效果圖

YDUI的ScrollTab(滾動選項卡)

WXML

<!--導(dǎo)航 -->
<view class="tui-fixed-left">
 <scroll-view class="tui-city-scroll" scroll-x="true">
  <text bindtap="getStatus" id="NAV{{index}}" class="tui-nav-li {{index === status ? 'tui-nav-active' : ''}}" data-index="{{index}}" wx:for="{{navList}}">{{item}}</text>
 </scroll-view>
</view>
<!--列表滾動區(qū) -->
 <view class="tui-fixed-y">
 <scroll-view class="tui-city-scroll-y" scroll-y="true" scroll-into-view="NAV{{status}}" scroll-with-animation="true">
  <view wx:for="{{navList}}">
   <view id="NAV{{index}}" class="tui-list-head">{{item}}</view>
   <view class="tui-list-li">{{item}} 列表 {{index}}</view>
  </view>
 </scroll-view>
</view>

WXSS

.tui-fixed-x{
 margin-left: 130px;
 position: fixed;
 top: 0;
 left: 0;
}
.tui-fixed-left{
 width: 120px;
 height: 100%;
 border-right: 1px solid #dfdfdf;
 position: fixed;
 background-color: #f5f5f5;
 top: 0;
 left: 0;
}
.tui-list-head{
 background-color: #fff;
 margin-bottom: 15px;
}
.tui-city-scroll{
 width: 100%;
}
.tui-nav-li{
 font-size: 30rpx;
 padding: 0 10px;
 height: 100rpx;
 line-height: 100rpx;
 width: 100px;
 display: block;
 border-bottom: 1px solid #dfdfdf;
 position: relative;
 z-index: 10;
}
.tui-nav-active{
 background-color: #fff;
}

.tui-fixed-y{
 margin-left: 120px;
 padding-left: 10px;
 padding-right: 10px;
 height: 100%;
 position: fixed;
 bottom: 0;
 right: 0;
}
.tui-city-scroll-y{
 height: 100%;
 box-sizing: border-box;
}
.tui-list-head{
 height: 50px;
 line-height: 50px;
 text-align: center;
 font-size: 30rpx;
 color: blue;
}
.tui-list-li{
 height: 400px;
 padding: 10rpx;
 color: #fff;
 font-size: 50rpx;
 background-color: lightgreen;
}

JS

Page({
 data: {
  navList: ['今日特惠', '煙灶推薦', '凈水飲水推薦', '洗碗機(jī)推薦', '電熱推薦', '燃熱推薦', '消毒柜推薦', '嵌入式推薦', '商用電器', '活動說明'],
  status: 0
 },
 getStatus(e) {
  this.setData({ status: e.currentTarget.dataset.index })
 }
})

總結(jié)

實現(xiàn)原理和處理方式都和微信小程序—-實現(xiàn)YDUI的ScrollNav組件一樣,細(xì)微的差別在于WXSS樣式表做了改變!

以上是“小程序如何實現(xiàn)YDUI中ScrollTab組件的示例”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)頁題目:小程序如何實現(xiàn)YDUI中ScrollTab組件的示例-創(chuàng)新互聯(lián)
標(biāo)題網(wǎng)址:http://muchs.cn/article32/dhghsc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、電子商務(wù)、網(wǎng)頁設(shè)計公司、做網(wǎng)站、響應(yīng)式網(wǎng)站、軟件開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)