新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
怎么用小程序YDUI的ScrollNav組件實(shí)現(xiàn)滾動(dòng)導(dǎo)航效果-創(chuàng)新互聯(lián)
這篇文章主要介紹怎么用小程序YDUI的ScrollNav組件實(shí)現(xiàn)滾動(dòng)導(dǎo)航效果,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
科爾沁左翼ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書(shū)未來(lái)市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)建站的ssl證書(shū)銷(xiāo)售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書(shū)合作)期待與您的合作!效果圖
實(shí)現(xiàn)原理
采用雙 scroll-view 組件實(shí)現(xiàn)雙滾動(dòng)!
WXML
{{item}} {{item}} {{item}} 列表 {{index}}
WXSS
.tui-fixed-x{ width: 100%; position: fixed; top: 0; left: 0; } .tui-city-scroll{ height: 80rpx; line-height: 80rpx; width: 100%; white-space: nowrap; } .tui-nav-li{ font-size: 30rpx; padding: 0 8rpx; } .tui-nav-li:first-child{padding-left: 16rpx;} .tui-nav-li:last-child{padding-right: 16rpx;} .tui-nav-active{color: red;} .tui-fixed-y{ width: 100%; height: calc(100% - 80rpx); position: fixed; bottom: 0; left: 0; } .tui-city-scroll-y{ padding: 0 20rpx; 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ī)推薦', '電熱推薦', '燃熱推薦', '消毒柜推薦', '嵌入式推薦', '商用電器','活動(dòng)說(shuō)明'], status: 0 }, getStatus(e){ this.setData({ status: e.currentTarget.dataset.index}) } })
注意
scroll-view 組件如果橫向滾動(dòng)必須要有一個(gè)可視寬度,縱向滾動(dòng)必須要有一個(gè)可視高度;
滾動(dòng)的定位采用 scroll-view 組件的 scroll-into-view 屬性,用 id 進(jìn)行定位。
以上是“怎么用小程序YDUI的ScrollNav組件實(shí)現(xiàn)滾動(dòng)導(dǎo)航效果”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
網(wǎng)頁(yè)名稱(chēng):怎么用小程序YDUI的ScrollNav組件實(shí)現(xiàn)滾動(dòng)導(dǎo)航效果-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)網(wǎng)址:http://www.dlmjj.cn/article/cchghd.html