50 lines
737 B
Vue
50 lines
737 B
Vue
<!--
|
|
filename: lineChart.vue
|
|
author: liubin
|
|
date: 2023-09-04 13:45:00
|
|
description:
|
|
-->
|
|
|
|
<template>
|
|
<div class="line-chart"></div>
|
|
</template>
|
|
|
|
<script>
|
|
import * as echarts from 'echarts';
|
|
|
|
export default {
|
|
name: 'LineChart',
|
|
components: {},
|
|
props: ['config'],
|
|
data() {
|
|
return {
|
|
chart: null,
|
|
};
|
|
},
|
|
computed: {},
|
|
mounted() {
|
|
this.init();
|
|
},
|
|
beforeDestroy() {
|
|
if (this.chart) {
|
|
this.chart.dispose();
|
|
}
|
|
},
|
|
methods: {
|
|
init() {
|
|
console.log('thsi el', this.$el);
|
|
if (!this.chart) this.chart = echarts.init(this.$el);
|
|
this.chart.setOption(this.config);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.line-chart {
|
|
padding: 0 12px;
|
|
background: #e1e1e1;
|
|
min-height: 320px;
|
|
}
|
|
</style>
|