美文网首页软件相关
mpvue使用antv F2图表页面上下无法滑动?

mpvue使用antv F2图表页面上下无法滑动?

作者: 会游泳的木鱼 | 来源:发表于2019-08-28 14:00 被阅读0次

解决方法

删除canvas组件的触摸事件回调,以下事件:

  • bindtouchstart
  • bindtouchmove
  • bindtouchend
  • bindtouchcancel
  • bindlongtap

文件结构:

wxapp
├─ dist
├─ ...
├─ src
└─ static
   ├─ f2-vanvas
   │  └─ lib
   ├─ ...
   └─ f2-canvas.wxml

f2-canvas.wxml页面代码如下:

<!-- 原canvas组件 -->
<canvas class="f2-canvas" canvas-id="{{ canvasId }}" bindinit="init"
 bindtouchstart="touchStart" bindtouchmove="touchMove" bindtouchend="touchEnd" bindlongtap="press"
>
</canvas>

<!-- 去除touch事件响应后 -->
<canvas class="f2-canvas" canvas-id="{{ canvasId }}" bindinit="init" ></canvas>

问题原因

图表canvas监听touch事件阻止冒泡,页面滑动无法触发。

反思

总是想着antv F2 的图表组件有问题,虽然也是有吧,但这是antv F2 拓展插件手势操作的,还是应该熟读文档。

相关文章

网友评论

    本文标题:mpvue使用antv F2图表页面上下无法滑动?

    本文链接:https://www.haomeiwen.com/subject/nhdpectx.html