Taotie_mie@163.com
Taotie_mie@163.com
  • 发布:2019-11-22 15:43
  • 更新:2019-11-22 15:43
  • 阅读:58

touchmove问题

分类:uni-app
<template>  
  <view class="content">  
    <swiper class="swiper" :duration="300">  
      <swiper-item @touchmove="onTouchmove"><view class="box">1</view></swiper-item>  
      <swiper-item><view class="box">2</view></swiper-item>  
      <swiper-item><view class="box">3</view></swiper-item>  
    </swiper>  
  </view>  
</template>  

<script>  
export default {  
  data() {  
    return {  
    };  
  },  
  onLoad() {},  
  methods: {  
    onTouchmove(event) {  
      // console.log(event)  

       // 为什么不能阻止touchmove?.stop 可以生效,但是我要基于事件对象编程  
      event.preventDefault()  
      event.stopPropagation()  
    }  
  }  
};  
</script>  

<style>  
.swiper {  
  height: 2000px;  
}  
.box {  
  padding-top: 100px;  
  text-align: center;  
  font-size: 25px;  
}  
</style>  
2019-11-22 15:43 分享
已邀请:

要回复问题请先登录注册