antvis / F2

📱📈An elegant, interactive and flexible charting library for mobile.
https://f2.antv.vision/zh
MIT License
7.89k stars 649 forks source link

小程序f2使用pinch报错 Cannot read property 'get' of undefined #627

Closed coldestlin closed 5 years ago

coldestlin commented 5 years ago

使用小程序版本的f2, 叠加interaction的时候,只要出现pinch动作就报错Cannot read property 'get' of undefined;.

引入方法, 参照 https://github.com/antvis/wx-f2 使用 npm install --production,然后在小程序内部用

let F2 = require("@antv/wx-f2")

程序中的出错部分的配置代码,其中swipe和pan都没有问题,只有pinch出现问题:

       chart.interaction('swipe');
        chart.interaction("pan");
        chart.interaction("pinch");

        chart.scrollBar({
          mode: "x",
          xStyle: {
            offsetY: -5
          }
        })
        chart.render();

报错信息:

thirdScriptError
Cannot read property 'get' of undefined;at SelectorQuery callback function
TypeError: Cannot read property 'get' of undefined
    at new e (http://127.0.0.1:59524/appservice/miniprogram_npm/@antv/wx-f2/index.js:5414:74)
    at e.a.interaction (http://127.0.0.1:59524/appservice/miniprogram_npm/@antv/wx-f2/index.js:817:75)
    at http://127.0.0.1:59524/appservice/pages/device/detail/detail.js:147:15
    at n.<anonymous> (http://127.0.0.1:59524/appservice/miniprogram_npm/@antv/f2-canvas/index.js:179:27)
    at Function.<anonymous> (WAService.js:1:738266)
    at WAService.js:1:102572
    at WAService.js:1:738549
    at Array.forEach (<anonymous>)
    at WAService.js:1:738522
    at WAService.js:1:739700

具体涉及到的语句是下面index.js的s.hammer.get("pinch")

  function e(e, i) {
            var a,
                s = n(n(a = t.call(this, e, i) || this));return s.hammer.get("pinch").set({ enable: !0 }), i.registerPlugins([c, { changeData: function changeData() {
                s.limitRange = {}, s.originTicks = null;
              }, clear: function clear() {
                s.limitRange = {}, s.originTicks = null;
              } }]), r.mix(s, h, l), s._bindPress(), a;
simaQ commented 5 years ago

小程序不支持 pinch 交互哦。