uniapp 小程序 charts绘图 安卓手机tooltip不显示,显示一次,再次点击无反应
Version
5.1.2
Steps to reproduce
安卓手机上tooltip显示,第一次正常,再次点击毫无反应
What is expected?
安卓手机显示tooltip
What is actually happening?
安卓手机未显示tooltip
Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that it contains a minimum reproducible demo and necessary images to illustrate. Otherwise, our committers will ask you to do so.
A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.
You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe our mailing list.
Have a nice day! 🍵
@tks-007 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
uniapp applet charts drawing Android mobile phone tooltip does not display, display once, click again, no response
BODY
Version
5.1.2
Steps to reproduce
The tooltip on the Android phone shows that it is normal the first time, but there is no response when clicking again.
What is expected?
Android phone display tooltip
What is actually happening?
Tooltip is not displayed on Android phones
是什么安卓手机?安卓版本是?什么浏览器?
@tks-007 Please provide a minimum reproducible demo for the issue either with https://codepen.io/Ovilia/pen/dyYWXWM , https://www.makeapie.com/editor.html or https://codesandbox.io/s/mystifying-bash-2uthz.
A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.
是什么安卓手机?安卓版本是?什么浏览器?
所有安卓机都不行,uniapp使用的 的是mpvue-echarts
跟这个 F-loat/mpvue-echarts#84 类似?
这个是由于echart源码通过wx全局变量判断是否是微信环境导致的问题。
echarts源码:
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方法,一个简单的解决方案就是在app入口执行下面方法:
/**
* 保存uniapp systemInfo结果以供后续调用
*/
export const systemInfo = wx?.getSystemInfoSync?.();
// @ts-ignore
wx && (wx.getSystemInfoSync = undefined);
需要注意下, 不能使用window.wx = undefined 来处理,因为build时uniapp会匹配 wx.xxx 关键字来注入并替换依赖
这个是由于echart源码通过wx全局变量判断是否是微信环境导致的问题。
echarts源码:
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方法,一个简单的解决方案就是在app入口执行下面方法:
/** * 保存uniapp systemInfo结果以供后续调用 */ export const systemInfo = wx?.getSystemInfoSync?.(); // @ts-ignore wx && (wx.getSystemInfoSync = undefined);需要注意下, 不能使用window.wx = undefined 来处理,因为build时uniapp会匹配 wx.xxx 关键字来注入并替换依赖
试了没作用
[system] TypeError: uni.getSystemInfoSync is not a function