Tencent / wepy

小程序组件化开发框架
https://wepyjs.gitee.io/wepy-docs/
Other
22.48k stars 3.06k forks source link

touchmove事件监听报错 #2756

Closed 476421978 closed 2 years ago

476421978 commented 2 years ago

Description:在进行监听手势touchmove滑动事件

Environment

Relevant Code / Logs

TypeError: Cannot read property 'apply' of undefined

Repetition code:代码复现

  <template>
    <div
      @touchmove="touchmove"
    >
      move移动事件监听
    </div>
  </template>
<script>
import wepy from '@wepy/core'
wepy.page({
    methods: {
        touchmove(e) {
            console.log('touchstart-->>', e)
       }
    }
})
</script>
yangbinji commented 2 years ago

@476421978 是不是因为 methdos 拼写错误,正确的应该是 methods

476421978 commented 2 years ago

@yangbinji 不是的,我这里改回来

476421978 commented 2 years ago

image

476421978 commented 2 years ago

没人遇到过吗???呃呃呃

weimingxinas commented 2 years ago

无法复现,能提供代码看看么

476421978 commented 2 years ago

没人复现过吗?感觉只有我一个人遇到这种情况呢

weimingxinas commented 2 years ago

请提供代码片段看看

weimingxinas commented 2 years ago

请提供代码片段看看

<template>
    <div
      @touchmove="touchmove"
      style="width:300rpx;height:200rpx;border:1rpx solid red;"
    >
      move2
    </div>
</template>

<script>
import wepy from '@wepy/core'
wepy.page({
  data: {
  },
  methods: {
    touchstart(e) {
      console.log('touchstart-->>')
    },
    touchmove(e) {
      console.log('touchstart-->>', e)
    }
  }
})
</script>

<style lang='less'>
</style>

https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html 按照这个提供下呢

476421978 commented 2 years ago

@weimingxinas 感谢大佬指导,经复现是编译后的缓存问题,请重删除weapp文件后重新编译即可