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

uniapp 小程序 charts绘图 安卓手机tooltip不显示,显示一次,再次点击无反应 #15334

Open
tks-007 opened this issue Jul 12, 2021 · 9 comments
Labels
bug missing-demo The author should provide a demo. pending We are not sure about whether this is a bug/new feature.

Comments

@tks-007
Copy link

tks-007 commented Jul 12, 2021

Version

5.1.2

Steps to reproduce

安卓手机上tooltip显示,第一次正常,再次点击毫无反应

What is expected?

安卓手机显示tooltip

What is actually happening?

安卓手机未显示tooltip

@echarts-bot
Copy link

echarts-bot bot commented Jul 12, 2021

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! 🍵

@echarts-bot echarts-bot bot added bug pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Jul 12, 2021
@echarts-bot
Copy link

echarts-bot bot commented Jul 12, 2021

@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

@plainheart
Copy link
Member

是什么安卓手机?安卓版本是?什么浏览器?

@plainheart plainheart added the missing-demo The author should provide a demo. label Jul 13, 2021
@echarts-bot
Copy link

echarts-bot bot commented Jul 13, 2021

@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.

@tks-007
Copy link
Author

tks-007 commented Jul 13, 2021

是什么安卓手机?安卓版本是?什么浏览器?

所有安卓机都不行,uniapp使用的 的是mpvue-echarts

@plainheart
Copy link
Member

跟这个 F-loat/mpvue-echarts#84 类似?

@tks-007
Copy link
Author

tks-007 commented Jul 13, 2021

跟这个 F-loat/mpvue-echarts#84 类似?

是的,几天忙了一天回复有点晚不好意思

@EggTronic
Copy link

EggTronic commented Apr 24, 2023

这个是由于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 关键字来注入并替换依赖

@daiwanxing
Copy link

这个是由于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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug missing-demo The author should provide a demo. pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

4 participants