用scroll-view做分页处理
但是bindscroll绑定函数 无效(我在写静态页面的时候,是可以拖动的,打印出来值,但是在渲染层就不行)
求解
下图是自己写的静态
这是渲染出来的效果
源码如下:
wxml
<
{{item}}
>
js
changeNum: function (e) {
this.setData({
lessonnumber: e.target.dataset.num
})
this.req_answerlist();
},
pageM:function(e) {
// console.log(e.currentTarget.dataset.ori);
var that = this;
if (e.currentTarget.dataset.ori === 'leftM') {
if (1 < that.data.lessonnumber && that.data.lessonnumber <= that.data.maxlessonnumber) {
that.setData({
scrollLeft: that.data.scrollLeft - 20,
lessonnumber: parseInt(that.data.lessonnumber) - 1
})
}
} else {
if (0 < that.data.lessonnumber && that.data.lessonnumber < that.data.maxlessonnumber) {
that.setData({
scrollLeft: that.data.scrollLeft + 20,
lessonnumber: parseInt(that.data.lessonnumber) + 1
})
}
}
this.req_answerlist();
},
//页面滚动
scroll: function (e) {
console.log(e.detail.scrollLeft)
this.setData({
scrollLeft: e.detail.scrollLeft
})
},
wxss
/*page*/
.page_con{
background: #fff;
justify-content: space-between;
padding: 20rpx;
}
.page_list{
width: 48rpx;
height: 48rpx;
border: 1rpx solid #209ee4;
border-radius: 50%;
text-align: center;
line-height: 48rpx;
font-size: 30rpx;
color: #209ee4;
}
.page_list.active{
background: #209ee4;
color: #fff;
}
.page_num{
width: 82%;
display: flex;
justify-content: space-between;
position: relative;
top: -2rpx;
}
.scroll-view_H .page_list{
display: inline-block;
margin-right:20rpx;
}
.scroll-view_H{
white-space: nowrap;
}
.scroll-view-item_H{
display: inline-block;
width: 100%;
}
/*page end*/
微信小程序开发问题解答
微信小程序开发者回答:
知道原因了!
太艰辛了!!!!
本页面引入了
@import "/wxParse/wxParse.wxss";
此wxss里面
view{
word-break:break-all; overflow:auto;
}
影响了 去掉就行了
本文网址:http://www.91bianli.com/weixinxiaochengxu/18351.html