uniapp小程序内uchart在swiper内无法点击!

一步一步走下来打印,最后发现是点击的时候h5的坐标是{x:50,y:150} 而小程序内的坐标是 {x:50,y:750};

就会发现小程序点击后获取的坐标明显的存在问题!所以每次并没有匹配到点击的图例,而且匹配到空白地方,所以就走了隐藏方法!


但是直接那uchart的dom试了下! 也不行!  于是就直接找到源码

\uni_modules\qiun-data-charts\js_sdk\u-charts\u-charts.js 文件内

uCharts.prototype.getCurrentDataIndex = function (e) {
  var touches = null;
  console.log(e)
  if (e.changedTouches) {
    touches = e.changedTouches[0];
  } else {
    touches = e.mp.changedTouches[0];
  }
    // #ifdef MP-WEIXIN
  touches.y = 50 // 强行在微信小程序内把y轴坐标改成50,
      // #endif
  console.log(touches)
  console.log(this.opts.type)

当然如果你采用的竖屏的可能也会有问题!但是出问题的点在这里,有别的需求的,可以自行根据此问题进行修复!

相关内容

发表评论

验证码:
点击我更换图片

最新评论