微信小程序使用ec-canvas真机上tooltip有阴影

发布时间 2023-05-31 15:40:30作者: ZerlinM

问题

微信小程序项目中,使用了ec-canvas绘制图表,在开发者工具中预览正常,但是在真机上点击图表tooltip会出现一层阴影,如下图所示:

修改后

解决

之后探索到解决方案,代码如下:

tooltip: {
  trigger: 'axis',
  textStyle: {
    align: 'left',
    textShadowBlur: 10, // 重点
    textShadowColor: 'transparent', // 重点
  },
},

在tooltip的textStyle中添加代码:

textShadowBlur: 10, // 重点
textShadowColor: 'transparent', // 重点

textShadowBlur必须写,并且不能为0,否则textShadowColor不生效