废话不多说,上代码 

需要将原来的 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" },
         ]),
        },

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐