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

Bug: uniapp 环境打包 h5。会注入 wx 全局变量。导致zrender 判断认为微信环境,从而引起echarts 功能异常 #1024

Open
xiaogaofudao opened this issue Jul 27, 2023 · 3 comments

Comments

@xiaogaofudao
Copy link

uniapp 环境打包 h5。会注入 wx 全局变量。导致zrender 判断认为微信环境,从而引起echarts 功能异常

@xiaogaofudao
Copy link
Author

建议加上 uni 判断,或者其他Env 判断方式。避免wx 污染从而引起判断bug

@xiaogaofudao
Copy link
Author

临时解决方案。import 改为 require 方式。加入如下 hack 代码

let fn = null;
if (typeof uni !== "undefined" && typeof wx !== "undefined") {
  fn = wx.getSystemInfoSync;
  wx.getSystemInfoSync = null;
}
const echarts = require("echarts");
if (fn) {
  wx.getSystemInfoSync = fn;
  fn = null;
}

@bpixdb30
Copy link

添加这段代码问题依旧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants