李狗蛋和陈二狗
李狗蛋和陈二狗
  • 发布:2021-10-25 11:23
  • 更新:2023-12-13 12:01
  • 阅读:956

canvas @touchstart 等方法在pc上无法执行

分类:uni-app

项目是用uniCloud admin做的一个后台项目,运行在pc浏览器上的,用的是360极速。
canvas 的 @touchstart @touchmove @touchend都无法执行。
但是浏览器控制台将设备更改成移动设备canvas 的 @touchstart @touchmove @touchend就能够执行。

代码

<canvas   
	class="canvas"  
	type="2d"   
	canvas-id="canvas"  
	@touchstart="touchStart"  
	@touchmove="touchMove"  
	@touchend="touchEnd"  
	@error="error"  
></canvas>  
  
  
methods: {  
	touchStart(e) {  
		console.log('start')  
	},	  
	touchMove(e) {  
		console.log('move')  
	},  
	touchEnd(e) {  
		console.log('end')  
	}  
}
2021-10-25 11:23 负责人:无 分享
已邀请:
深海智行

深海智行 - 专注前端培训

我测试了我的surface pro是可以支持的,你确定你的设备有触摸屏吗?如果没有可以使用原始鼠标事件。

1***@qq.com

1***@qq.com

我这是 H5 端 canvas 没有touch响应事件

要回复问题请先登录注册