267 Star 1.8K Fork 324

GVPuCharts / uCharts

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

缺陷
待办的
xplee  Opened this issue

该问题是怎么引起的?

启用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;
}
}
};

Attachments
total 1 participants

Comments (0)

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
JavaScript
1
https://git.oschina.net/uCharts/uCharts.git
git@git.oschina.net:uCharts/uCharts.git
uCharts
uCharts
uCharts

Search

152606 8668e384 1899542 133635 2cd7d36e 1899542