mirror of
https://github.com/ngfchl/ptools
synced 2023-07-10 13:41:22 +08:00
初步实现数据图表,待完善
This commit is contained in:
27
static/js/echarts-component.js
Normal file
27
static/js/echarts-component.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 封装echarts,可以在vue中使用
|
||||
*/
|
||||
|
||||
Vue.component('charts', {
|
||||
props: ['option', 'style'], data: function () {
|
||||
return {}
|
||||
}, mounted: function () {
|
||||
this.$nextTick(function () {
|
||||
var el = this.$el;
|
||||
var chart = echarts.init(el, 'dark');
|
||||
chart.setOption(this.option);
|
||||
this.chart = chart
|
||||
})
|
||||
}, watch: {
|
||||
obj: {
|
||||
option(newValue, oldValue) {
|
||||
// option发生变化时自动重新渲染
|
||||
this.chart.setOption(newValue)
|
||||
}, // immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
|
||||
}, template: '<div :style="style">{{option}}</div>'
|
||||
})
|
||||
|
||||
|
||||
45
static/js/echarts.min.js
vendored
Normal file
45
static/js/echarts.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user