vue中echarts渐变被覆盖、失效,echarts.graphic.LinearGradient,不能正常显示的解决方法。
echarts渐变被覆盖、失效,echarts.graphic.LinearGradient,不能正常显示的解决方法。
·
废话不多说,上代码
需要将原来的 new echarts.graphic.LinearGradient 改成这样:
new this.$echarts.graphic.LinearGradient that.$echarts.graphic.LinearGradient
//抄作业的渐变代码
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#6DF1FD" },
{ offset: 1, color: "#62D5FA" },
]),
},
//vue中出问题的代码
itemStyle: {
color: that.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#6DF1FD" },
{ offset: 1, color: "#62D5FA" },
]),
},
//解决后的Vue代码
itemStyle: {
color: new that.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#6DF1FD" },
{ offset: 1, color: "#62D5FA" },
]),
},
更多推荐
已为社区贡献2条内容
所有评论(0)