提交 dffd5196 编写于 作者: shutao-dc's avatar shutao-dc

调整scroll-view示例 增加scroll-x、scroll-y均为false的场景 可正常触发touchmove事件

上级 db8b0f2b
......@@ -12,10 +12,11 @@
<text class="uni-text">{{item.label}}</text>
</view>
</scroll-view>
<scroll-view v-else :scroll-x="false" :scroll-top="scrollTop" :scroll-left="scrollLeft"
<scroll-view v-else :scroll-y="scrollY" :scroll-top="scrollTop" :scroll-left="scrollLeft"
:upper-threshold="upperThreshold" :lower-threshold="lowerThreshold" :scroll-into-view="scrollIntoView"
:enable-back-to-top="enableBackToTop" :scroll-with-animation="scrollWithAnimation"
:show-scrollbar="showScrollbar" :rebound="rebound" @scrolltoupper="scrolltoupper"
:show-scrollbar="showScrollbar" :rebound="rebound" @scrolltoupper="scrolltoupper"
@touchmove="onTouchMove"
@scrolltolower="scrolltolower" @scroll="scroll" @scrollend="scrollend" ref="scrollViewY" id="scrollViewY">
<view class="item" :id="item.id" v-for="(item,_) in items">
<text class="uni-text">{{item.label}}</text>
......@@ -38,7 +39,11 @@
</view>
<view class="uni-option">
<text>是否横向滚动</text>
<switch :checked="scrollX" @change="changeDirection"></switch>
<switch :checked="scrollX" @change="changeDirectionX"></switch>
</view>
<view class="uni-option">
<text>是否竖向滚动</text>
<switch :checked="scrollY" @change="changeDirectionY"></switch>
</view>
<view class="uni-common-pb"></view>
<view class="uni-slider">
......@@ -86,7 +91,8 @@
data() {
return {
items: [] as Item[],
scrollX: false,
scrollX: false,
scrollY: true,
rebound: false,
scrollTop: 0,
scrollLeft: 0,
......@@ -115,10 +121,21 @@
handleChangeScrollTop(e : SliderChangeEvent) {
this.scrollTop = e.detail.value;
},
changeDirection() {
this.scrollX = !this.scrollX;
changeDirectionX() {
this.scrollX = !this.scrollX;
if(this.scrollX) {
this.scrollY = false
}
this.scrollTop = 0;
this.scrollLeft = 0;
},
changeDirectionY() {
this.scrollY = !this.scrollY;
if(this.scrollY) {
this.scrollX = false
}
this.scrollTop = 0;
this.scrollLeft = 0;
},
handleScrollIntoView() {
if (this.scrollX) {
......@@ -160,6 +177,9 @@
scrollend() {
console.log("滚动停止");
},
onTouchMove() {
console.log("TouchMove");
},
//自动化测试专用
checkScrollHeight(): Boolean {
var element = this.$refs["scrollViewY"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册