You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
514 B
Vue
36 lines
514 B
Vue
<template>
|
|
<div />
|
|
</template>
|
|
|
|
<script>
|
|
import * as echarts from 'echarts';
|
|
|
|
export default {
|
|
expose: ['setData'],
|
|
data() {
|
|
return {
|
|
chart: null,
|
|
}
|
|
},
|
|
mounted() {
|
|
},
|
|
beforeDestroy() {
|
|
if (!this.chart) {
|
|
return
|
|
}
|
|
this.chart.dispose()
|
|
this.chart = null
|
|
},
|
|
methods: {
|
|
setData(option) {
|
|
this.initChart(option)
|
|
},
|
|
initChart(option) {
|
|
this.chart = echarts.init(this.$el, 'macarons')
|
|
|
|
this.chart.setOption(option)
|
|
}
|
|
}
|
|
}
|
|
</script>
|