12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <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>
|