Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canvas不能触发touch事件 #3209

Closed
moohng opened this issue Jan 20, 2022 · 5 comments
Closed

canvas不能触发touch事件 #3209

moohng opened this issue Jan 20, 2022 · 5 comments
Assignees
Labels
bug Something isn't working mp-weixin 微信小程序 vue3

Comments

@moohng
Copy link

moohng commented Jan 20, 2022

问题描述
真机上canvas不能触发绑定的touch事件

复现步骤

  1. 通过官方命令创建项目 npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project
  2. 安装项目依赖并启动scripts命令 dev:mp-weixin
  3. 微信开发者工具打开并真机扫码预览;
<template>
  <canvas id="cs" type="2d" @touchstart="onTouchStart"></canvas>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  methods: {
    onTouchStart() {
      uni.showToast({ title: 'touch start', icon: 'none' });
    },
  }
});
</script>

预期结果
真机上正常弹出toast提示信息

实际结果
无任何反应,没有执行 onTouchStart 方法

系统信息:

  • 发行平台: 微信小程序
  • 操作系统:Android 11
  • uni-app版本:v3.0.0-alpha-3030820220114001
  • 设备信息:安卓机

补充信息
创建Vue2的正式版项目则没有此问题

@zhetengbiji
Copy link
Collaborator

@netdreamwing
Copy link

vite + vue3 遇到同样问题,开发者工具没有问题,真机测试所有touch时间都不能触发,tap可触发

版本号:^3.0.0-alpha-3030920220121001

vue2 开发者工具和真机测试都没有问题

@netdreamwing
Copy link

这个问题影响还是挺大的,之前vue2没问题,项目迁移vue3重构遇到这个问题卡主了,下一个版本能修复吗? @zhetengbiji

@fxy060608 fxy060608 self-assigned this Jan 24, 2022
@fxy060608 fxy060608 added bug Something isn't working mp-weixin 微信小程序 vue3 labels Jan 24, 2022
@fxy060608
Copy link
Collaborator

这个问题影响还是挺大的,之前vue2没问题,项目迁移vue3重构遇到这个问题卡主了,下一个版本能修复吗? @zhetengbiji

已修复,cli更新至:3.0.0-alpha-3030820220114006

@yjt1216
Copy link

yjt1216 commented Dec 13, 2023

H5 端 canvas 在uni-canvas 包裹下没有touch事件响应

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mp-weixin 微信小程序 vue3
Projects
None yet
Development

No branches or pull requests

5 participants