gy-app-shop/pages/home/wisdomElectricity/historyCurve/common/mixins.js

45 lines
735 B
JavaScript

export default {
props: {
chartData: {
type: Object,
default() {
return {}
}
}
},
data() {
return {
switchList: ["柱状图","折线图","数据视图"],
pickIndex: 0,
barChart: false,
polyLineChart: false,
tableChart: false,
dataSource: {}
}
},
created() {
this.dataSource = this.chartData;
},
watch: {
chartData(newVal) {
this.dataSource = newVal;
}
},
methods: {
switchFn(item,index){
this.pickIndex = index;
this.barChart = false;
this.polyLineChart = false;
this.tableChart = false;
},
onRenderFinshBar() {
this.barChart = true;
},
onRenderComplete() {
this.polyLineChart = true;
},
onRenderFinshTable() {
this.tableChart = true;
}
}
}