vue-cli项目使用echarts

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/woshidamimi0/article/details/84818894

npm install安装,然后即可在依赖包中看到echarts

在main.js中引入,然后挂载到Vue的原型上面,这样每个vue实例都会有这个属性。$charts是自定义的名称,随便。

在需要的地方就可以用this.$charts来调用了。如图,我在methods里面中调用,注意this必须指向的是vue实例才可以调用。

同样,new echarts 对应变为new this.$charts即可。

猜你喜欢

转载自blog.csdn.net/woshidamimi0/article/details/84818894