uniapp使用echarts,tooltip中的formatter没有解析html成功,请问是为什么?

uniapp中使用echarts,在tooltip中设置formatter页面渲染成字符串了
image.png
这是formatter内容:

  // 工具浮窗
  tooltip: {
    trigger: "axis",
    // 鼠标移入的轴线配置
    axisPointer: {
      lineStyle: {
        color: "#FF8B02"
      }
    },
    formatter: (e) => this.getCurrentDate(e)
  }



getCurrentDate(params) {
    let res = ""
    let time = `<span>${params[0].axisValue}</span><br/>`
    res += time
    for (let i = 0; i < params.length; i++) {
        res += `<span style="display:inline-block;margin-right:4px;">${params[i].marker}</span>
                 <span style="display:inline-block;width:80px;height:20px;">${params[i].seriesName}</span>
                 <span style="display:inline-block;width:30px;height:20px;">${params[i].data}</span><br/>`
    }
    return res
}

奇怪的是中间那个圆点解析成功了,圆点的数据如下:
image.png

阅读 1.7k
1 个回答
新手上路,请多包涵

因为echarts 源码中的判断 typeof wx 其中的 wx 变量与uniapp 中重复了 修改下源码就可以了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题