<scroll-view scroll-x class="scroll-x" scroll-left="{{navScrollLeft}}" scroll-with-animation="{{true}}" bindscroll="scrollchange">
scrollchange: function(event){
this.setData({
scrollLeft: event.detail.scrollLeft
});
console.dir(event.detail.scrollLeft);
},
centerTap: function (event) {
//點(diǎn)擊的偏移量
// console.log(event);
var cur = event.detail.x + this.data.scrollLeft;
// console.log(cur);
// console.log(wx.getSystemInfoSync().windowWidth);
//每個tab選項(xiàng)寬度占15%
var singleNavWidth = wx.getSystemInfoSync().windowWidth * 16 / 100;
// console.log(singleNavWidth);
this.setData({
clickNumber: parseInt(cur / singleNavWidth)
})
微信小程序利用scroll-view和swiper實(shí)現(xiàn)標(biāo)簽頁小程序?qū)崿F(xiàn)一個聯(lián)動的效果,具體效果看圖。 上方是一個可滾動的標(biāo)簽欄伤塌。下面也是可以滾動的內(nèi)容區(qū)界睁。點(diǎn)擊上方標(biāo)簽欄骆姐,下方內(nèi)容跟著切換到響應(yīng)的界面译仗。下面滾動時候拼弃,上面的標(biāo)簽欄也跟隨切...