395 Star 3.4K Fork 663

GVPuCharts / uCharts

 / 详情

touch事件报错(微信小程序)

已完成
缺陷
创建于  
2020-06-11 21:07

该问题是怎么引起的?

启用x轴滚动,touch事件报错(微信小程序)

重现步骤

gitee下载最新的文件[/uCharts-for-微信小程序(原生)/u-charts.min.js], 微信小程序中,启用x轴滚动,touch事件报错

报错信息

TypeError: Cannot read property 'changedTouches' of undefined
at Charts.scrollStart (http://127.0.0.1:56921/appservice/plugin/ucharts/u-charts.min.js:2265:16)

分析:
源码中获取touches时使用了e.mp,而微信小程序中e.mp=undefined,导致出错。
Charts.prototype.scrollStart = function(e) {
var touches = e.mp.changedTouches[0] || e.changedTouches[0];
var _touches$ = getTouches(touches, this.opts, e);
if (touches && this.opts.enableScroll === true) {
if (touches.x) {
this.scrollOption.startTouchX = _touches$.x;
} else {
this.scrollOption.startTouchX = _touches$.clientX;
}
}
};

评论 (0)

xplee 创建了缺陷
xplee 关联仓库设置为uCharts/uCharts
16cheng 任务状态待办的 修改为已完成
展开全部操作日志

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(1)
JavaScript
1
https://gitee.com/uCharts/uCharts.git
git@gitee.com:uCharts/uCharts.git
uCharts
uCharts
uCharts

搜索帮助