Skip to content

BUG: tooltip with html not working on the H5 site created by uniapp #14136

@wenjie-kooboo

Description

@wenjie-kooboo

Version

4.9.0

Steps to reproduce

The example as follows is working on normal web site, but it is not working on the H5 site which is created by uniapp:

option = {
    title: {
        text: '某站点用户访问来源',
        subtext: '纯属虚构',
        left: 'center'
    },
    tooltip: {
        trigger: 'item',
        formatter: function() {
            return '<div style="color:red">Hello world</div>';
        }
    },
    legend: {
        orient: 'vertical',
        left: 'left',
    },
    series: [
        {
            name: '访问来源',
            type: 'pie',
            radius: '50%',
            data: [
                {value: 1048, name: '搜索引擎'},
                {value: 735, name: '直接访问'},
                {value: 580, name: '邮件营销'},
                {value: 484, name: '联盟广告'},
                {value: 300, name: '视频广告'}
            ],
            emphasis: {
                itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};

What is expected?

The text in tooltip should be red

What is actually happening?

the text with html tags is showing


In "zrender\lib\core\env.js" line 12, I found this code:

 if (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {

but the site created by uniapp , typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function' is true.
for example, this site https://hellouniapp.dcloud.net.cn/, you can open Console of Chrome, and run typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function', you can see it's true, but it's not wechat application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpendingWe are not sure about whether this is a bug/new feature.staleInactive for a long time. Will be closed in 7 days.topic: tooltipwaiting-for: community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions