You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
844 B
43 lines
844 B
|
6 years ago
|
import {isEmpty, waitUntilSuccess} from "@/util"
|
||
|
6 years ago
|
|
||
|
|
export default {
|
||
|
|
props: {
|
||
|
|
width: {
|
||
|
|
type: String,
|
||
|
|
default: '100%'
|
||
|
|
},
|
||
|
|
height: {
|
||
|
|
type: String,
|
||
|
|
default: '350px'
|
||
|
|
}
|
||
|
|
},
|
||
|
6 years ago
|
|
||
|
6 years ago
|
data() {
|
||
|
|
return {
|
||
|
6 years ago
|
loading: false
|
||
|
6 years ago
|
}
|
||
|
|
},
|
||
|
6 years ago
|
|
||
|
6 years ago
|
methods: {
|
||
|
|
$_getChartInstance() {
|
||
|
|
return waitUntilSuccess(
|
||
|
|
() => !isEmpty(window.echarts),
|
||
|
|
() => this.chart = window.echarts.init(this.$_getChartDom(), 'macarons')
|
||
|
|
)
|
||
|
|
},
|
||
|
|
$_getChartDom() {
|
||
|
|
return this.$el
|
||
|
|
}
|
||
|
|
},
|
||
|
6 years ago
|
|
||
|
6 years ago
|
mounted() {
|
||
|
|
this.$_getChartInstance().then(() => this.init())
|
||
|
|
},
|
||
|
6 years ago
|
|
||
|
6 years ago
|
beforeDestroy() {
|
||
|
|
if (!this.chart) return
|
||
|
|
this.chart.dispose()
|
||
|
|
this.chart = null
|
||
|
|
}
|
||
|
|
}
|