yudao-dev/src/views/equipment/analysis/quality/components/lineChart.vue

50 lines
737 B
Vue
Raw Normal View History

2023-09-04 13:54:37 +08:00
<!--
filename: lineChart.vue
author: liubin
date: 2023-09-04 13:45:00
description:
-->
<template>
2023-09-04 14:35:13 +08:00
<div class="line-chart"></div>
2023-09-04 13:54:37 +08:00
</template>
<script>
2023-09-04 14:35:13 +08:00
import * as echarts from 'echarts';
2023-09-04 13:54:37 +08:00
export default {
name: 'LineChart',
components: {},
props: ['config'],
data() {
return {
2023-09-04 14:35:13 +08:00
chart: null,
};
2023-09-04 13:54:37 +08:00
},
computed: {},
2023-09-04 14:35:13 +08:00
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);
},
},
2023-09-04 13:54:37 +08:00
};
</script>
<style scoped lang="scss">
.line-chart {
2023-09-04 14:35:13 +08:00
padding: 0 12px;
2023-09-04 13:54:37 +08:00
background: #e1e1e1;
2023-09-04 14:35:13 +08:00
min-height: 320px;
2023-09-04 13:54:37 +08:00
}
</style>