<template>
  <div>
    <div id="main">

    </div>
  </div>
</template>

<script>
// 组件
let echarts = require('echarts');

export default {
  name:'bs-chart',
  props:{
    series: {
      type: Array
    },
  },
  data() {
    return {
      seriesData: this.series
    }

  },
  watch: {
    series(v) {
      this.myChart.setOption({
          xAxis: {
              show: false,
              data : [' ',' ',' ']
          },
          yAxis: {
            show: false
          },
          series: v
      });
      this.seriesData = v;
    }
  },
  mounted(){
    // 基于准备好的dom，初始化echarts实例
    this.myChart = echarts.init(document.getElementById('main'));
    this.myChart.setOption({
        xAxis: {
            show: false,
            data : [' ',' ',' ']
        },
        yAxis: {
          show: false
        },
        series: this.seriesData
    });
  },
  methods:{

  },
  components:{

  },
}
</script>
<style lang="less">
#main, #main2{
  width: 120px;
  height: 60px;
  border: 1px solid red;
}

</style>
