提交 3bb18cf9 编写于 作者: Anne_LXM's avatar Anne_LXM

调整scroll-view事件类型

上级 713dc89a
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<text class="uni-subtitle-text">横向滚动</text> <text class="uni-subtitle-text">横向滚动</text>
</view> </view>
<view> <view>
<scroll-view class="scroll-view_H" direction="horizontal" @scroll="scroll" :scroll-left="scrollLeft" :show-scrollbar="showScrollbar"> <scroll-view class="scroll-view_H" direction="horizontal" @scroll="scroll" @scrollend="end" :scroll-left="scrollLeft" :show-scrollbar="showScrollbar">
<view class="scroll-view-item_H uni-bg-red"><text class="text">A</text></view> <view class="scroll-view-item_H uni-bg-red"><text class="text">A</text></view>
<view class="scroll-view-item_H uni-bg-green"><text class="text">B</text></view> <view class="scroll-view-item_H uni-bg-green"><text class="text">B</text></view>
<view class="scroll-view-item_H uni-bg-blue"><text class="text">C</text></view> <view class="scroll-view-item_H uni-bg-blue"><text class="text">C</text></view>
...@@ -77,18 +77,21 @@ ...@@ -77,18 +77,21 @@
} }
}, },
methods: { methods: {
upper: function (e : ScrollToUpperEvent) { upper: function (e : UniScrollToUpperEvent) {
console.log('滚动到顶部/左边',e) console.log('滚动到顶部/左边',e)
this.toUpperTest = e this.toUpperTest = e
}, },
lower: function (e : ScrollToLowerEvent) { lower: function (e : UniScrollToLowerEvent) {
console.log('滚动到底部/右边',e) console.log('滚动到底部/右边',e)
this.toLowerTest = e this.toLowerTest = e
}, },
scroll: function (e : ScrollEvent) { scroll: function (e : UniScrollEvent) {
this.scrollTest = e this.scrollTest = e
this.oldScrollTop = e.detail.scrollTop this.oldScrollTop = e.detail.scrollTop
}, },
end: function (e : UniScrollEvent){
console.log('滚动结束时触发',e)
},
goTop: function () { goTop: function () {
// 解决view层不同步的问题 // 解决view层不同步的问题
this.scrollTop = this.oldScrollTop this.scrollTop = this.oldScrollTop
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册