forked from github/dataease
feat(视图): echarts组件封装,初步实现
This commit is contained in:
parent
00bce0ee7e
commit
6c28ec072e
@ -16,7 +16,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
myChart: {}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chart() {
|
chart() {
|
||||||
@ -24,6 +26,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
// 基于准备好的dom,初始化echarts实例
|
||||||
|
this.myChart = this.$echarts.init(document.getElementById('echart'))
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
drawEcharts() {
|
drawEcharts() {
|
||||||
@ -48,12 +52,10 @@ export default {
|
|||||||
this.myEcharts(chart_option)
|
this.myEcharts(chart_option)
|
||||||
},
|
},
|
||||||
myEcharts(option) {
|
myEcharts(option) {
|
||||||
// 基于准备好的dom,初始化echarts实例
|
|
||||||
var myChart = this.$echarts.init(document.getElementById('echart'))
|
|
||||||
// 指定图表的配置项和数据
|
// 指定图表的配置项和数据
|
||||||
setTimeout(myChart.setOption(option, true), 500)
|
setTimeout(this.myChart.setOption(option, true), 500)
|
||||||
window.onresize = function() {
|
window.onresize = function() {
|
||||||
myChart.resize()
|
this.myChart.resize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user