I want to use Baidu's echarts in vue. Why did I introduce this library page and not show it?

clipboard.png

clipboard.png

clipboard.png
just can"t show it. Thank you very much for your advice.

Feb.26,2021

copy a simple bar chart and test it in the previous document. It feels like there is something wrong with the definition of series data, and the introduction of components requires you to manually import gauge,. Anyway, everything you use should be written here, otherwise it will not display
var echarts = require ('echarts/lib/echarts');
/ / introduce bar chart
require (' echarts/lib/chart/bar');
require ('echarts/lib/chart/gauge').
/ introduce prompt box and title component
require ('echarts/lib/component/tooltip');
require (' echarts/lib/component/title');
require ('echarts/lib/component/legend');


you need to use a version packaged into components. There are many on Github. Post two for your reference:

vue-echarts

v-charts


does this div have height?


the echarts library you introduced in main.js, but used in other components, certainly won't work.
two methods:

  1. if echarts, is only used in this component, it is recommended that you reference echarts, in this component instead of main.js.
  2. if it must be referenced in main.js, it is recommended to write:
// component
let myChart = this.$echarts.init(this.$refs.myChart)
Menu