EggTronic commented on issue #15334:
URL: https://github.com/apache/echarts/issues/15334#issuecomment-1526921079

   > 这个是由于echart源码通过wx全局变量判断是否是微信环境导致的问题。
   > 
   > echarts源码:
   > 
   > ```js
   > if (typeof wx === "object" && typeof wx.getSystemInfoSync === "function") 
{ 
   >   // echarts在这里会关闭dom支持
   > }
   > ```
   > 
   > 当wx.getSystemInfoSync为function时,echarts会认为你在微信小程序环境中,不支持通过dom渲染tooltip。 
而uniapp正好会在全局注入一个wx变量,且拥有wx.getSystemInfoSycn方法,这里会产生一个问题,就是基于uniapp开发的h5页面,即使应该支持dom,也会被eschart认为是小程序而关闭dom相关的能力支持。
   > 
   > 在h5中,如果你代码里没有使用wx.getSystemInfoSync方法,一个简单的解决方案就是在加载echarts之前执行下面方法:
   > 
   > ```js
   > wx.getSystemInfoSync = undefined;
   > ```
   
   
需要注意的是,本地开发serve时wx是注入在window中的,而build时,uniapp会全局匹配"wx.xxx"去做替换,因此build时不能使用window.wx.getSystemInfoSync
 = {} 来解决问题


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to