<template>
<view class="page-container">
<canvas class="signature" canvas-id="cvs" type="2d" @touchstart="touchstart"
@touchmove="touchmove" @touchend="touchend" @tap="onTap"></canvas>
</view>
</template>
<script>
export default {
data() {
return {
cid: 'cvs',
lines: [],
line: null,
}
},
onLoad() {
},
onShow(){
},
methods: {
onTap(){
console.log("12312")
},
touchstart(e) {
console.log("===start")
console.log(e)
let p = this._get_point(e);
console.log(p)
},
touchmove(e) {
console.log("===move")
console.log(e)
let p = this._get_point(e);
console.log(p)
},
touchend(e) {
let p = this._get_point(e);
console.log("===end")
console.log(p)
},
_get_point(e) {
return {
x: e.changedTouches[0].x.toFixed(1),
y: e.changedTouches[0].y.toFixed(1),
}
},
}
}
</script>
<style lang="scss" scoped>
.page-container{
.signature{
border: 2rpx dotted #000;
background:#fff;
}
}
</style>

- 发布:2023-04-28 14:34
- 更新:2023-04-28 14:55
- 阅读:204
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows 11
HBuilderX类型: 正式
HBuilderX版本号: 3.7.11
第三方开发者工具版本号: stable 1.06
基础库版本号: 不清楚
项目创建方式: HBuilderX
示例代码:
操作步骤:
微信开发者工具 -> 真机调试 ->自动真机模式(2.0)->启动PC端自动真机调试
微信开发者工具 -> 真机调试 ->自动真机模式(2.0)->启动PC端自动真机调试
预期结果:
touch事件触发打印结果
touch事件触发打印结果
实际结果:
事件未触发,未打印结果
事件未触发,未打印结果
bug描述:
微信开发者工具 -> 真机调试 ->自动真机模式(2.0)->启动PC端自动真机调试
touch事件不生效
1 个回复
YUANRJ
在原生微信小程序中测试下