Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用webpack打包的Echarts 在Ms Edge浏览器 下报“调用的对象无效” 错误 #5322

Closed
Link-Fight opened this issue Mar 21, 2017 · 4 comments
Labels

Comments

@Link-Fight
Copy link

One-line summary [问题简述]

  • 使用webpack打包工具,在chrome浏览器下是完美运行。

  • 而在Ms Edge浏览器里,如果是使用提供的已经打包过的echarts

    var echarts = require('echarts/dist/echarts');

    也是可以完美运行的。

  • 但是如果是用

    var echarts = require('echarts');

    或者

    var echarts = require('echarts/lib/echarts');

    require('echarts/lib/component/title');

    require('echarts/lib/component/graphic');

    这两种引入方式的时候,在MS Edge里会报 “调用的对象无效” 的错误信息

  • 通过逐步debug 发现出错的stack是

    echarts.init

      new Echarts(dom, theme, opts)
    
          zrender.init
    
                  var zr = new ZRender(guid(), dom, opts);
    
                       this.animation.start();
    
                          this._startLoop();
    
                              requestAnimationFrame
    
  • 就是运行到 zrender/lib/animation/Animation.js 里面的 line:177 行的 requestAnimationFrame 函数就报错 而这个方法来自

    var requestAnimationFrame = require('./requestAnimationFrame');

  • 而如果我直接修改Animation.js 中line:177 的requestAnimationFrame 为 window.的requestAnimationFrame(edge的window直接有这个方法)的时候,此时又可以正常运行了

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 3.4.0 ,[zrender]:3.3.0
  • Browser version [浏览器类型和版本]:Microsoft Edge 38.14393.0.0 , Microsoft EdgeHTML 14.14393
  • OS Version [操作系统类型和版本]:Windows 10 Version 1607

Expected behaviour [期望结果]

在Edge里面可以正常运行

ECharts option [ECharts配置项]

option = {

}

Other comments [其他信息]

@txiejun
Copy link

txiejun commented Mar 22, 2017

是的,我刚也遇到和楼上完全一样的问题:我用的操作系统是window7。ECharts version [ECharts 版本]: 3.4.0 ,[zrender]:3.3.0 ,在Firefox42.0和Chrome 55.0都可以正常运行,在IE11.0.9浏览器上运行requestAnimationFrame调用报错 “调用的对象无效” ,尝试使用Polyfill 发现没用,因为echart内部使用的是var requestAnimationFrame = require('./requestAnimationFrame'); 自已引入的requestAnimationFrame 方法

@txiejun
Copy link

txiejun commented Mar 22, 2017

@liuchang567
Copy link

我两个都试过了还是不行,直接引入外部的echarts又可以,请问最后是怎么解决这个问题的

@holidaying
Copy link

如何解决ie找不到对象问题?

@pissang pissang closed this as completed Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants