IOS上 canvas无法取得longtap事件
发布于 6 年前 作者 lzhao 16518 次浏览 来自 问答

昨天在一个朋友的IOS手机上测试发布的小程序时,发现IOS下, 由

cover-view

组件覆盖的canvas,始终无法触发canvas 绑定的longtap事件,而在所有安卓手机上正常布局文件:

<view>

<!-- canvas.wxml -->

<canvas style=“width: 100vh; height:100vh;”

        canvas-id=“MainView”

        disable-scroll=‘true’

        bindtouchstart=“touchstart”

        bindtouchmove=“touchmove”

        bindtouchend=“touchend”

        bindlongtap=“longtap”>

        <cover-image class=“shareImg” bindtap=“Exit” src=’./image/exit1.png’></cover-image>

        <cover-view class=“share”>

            <!–cover-image open-type=“share” src="./image/defaultIcon.png"/–>

            <!–cover-image class=“shareImg” src=’./image/addFriends.png’></cover-image–>

            <button class=‘shareButton’ open-type=‘share’>邀请好友</button>

        </cover-view>

</canvas>

</view>---------------------------------------------------------------------------------------------------------------------------------wxs:

/**用户手指触摸i */

  touchstart:function(e){

    board.touchstart(e);//传递触摸事件

  },

  touchmove:function(e){

    board.touchmove(e);

  },

  touchend:function(e){

    board.touchend(e);

  },

  longtap:function(e){

    board.longtap(e);

  }

3 回复

提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

catch 好像是可以,我刚才写的时候也遇到ios下bind不可以的情况,不知道为什么

因为我没有苹果手机,我只能提供代码片段给您,wechatide://minicode/F3DPzpmD733E代码在所有安卓系统下以及开发者工具模拟器下运行正常,都能触发longtap 长按,以实现长按拖动好友头像的能力。

回到顶部