<template>
	<canvas canvas-id="chart" ref="chart" :style="{width: '100%', height}"></canvas>
</template>

<script>
import * as echarts from '@/packageA/static/js/echarts.js';	
export default {
  props:{
	  ec:{
		  type:Object
	  },
	  height:{
		  type:String,
		  default:'300px'
	  }
  },
  watch: {
	  'ec.option': {
	  		handler(val) {
	  		  if (val) {
	  			this.chart.setOption(val);
	  		  }
	  		},
	  		deep: true
	  }
  },
  mounted() {
	this.init()
  },
  data() {
    return {

    };
  },
  methods:{
	  init(){
		  this.chart = echarts.init(this.$refs.chart.$el);
	  }
  }
};
</script>

<style scoped>
.uni-ec-canvas {
  width: 100%;
  height: 600upx;
  display: block;
}
</style>
