小編給大家分享一下微信小程序如何實現ScrollTab組件滾動選項卡效果,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
10年積累的成都網站設計、成都做網站經驗,可以快速應對客戶對網站的新想法和需求。提供各種問題對應的解決方案。讓選擇我們的客戶得到更好、更有力的網絡服務。我雖然不認識你,你也不認識我。但先網站設計后付款的網站建設流程,更有遵義免費網站建設讓你可以放心的選擇與我們合作。
WXML
<!--導航 --> <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> <!--列表滾動區 --> <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: ['今日特惠', '煙灶推薦', '凈水飲水推薦', '洗碗機推薦', '電熱推薦', '燃熱推薦', '消毒柜推薦', '嵌入式推薦', '商用電器', '活動說明'], status: 0 }, getStatus(e) { this.setData({ status: e.currentTarget.dataset.index }) } })
以上是“微信小程序如何實現ScrollTab組件滾動選項卡效果”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注創新互聯行業資訊頻道!
當前標題:微信小程序如何實現ScrollTab組件滾動選項卡效果
URL標題:http://vcdvsql.cn/article42/gjsphc.html
成都網站建設公司_創新互聯,為您提供網頁設計公司、響應式網站、用戶體驗、網站收錄、域名注冊、手機網站建設
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯