|
@@ -25,6 +25,10 @@ export default {
|
|
clickOnTheEvent: { // 是否开启点击事件
|
|
clickOnTheEvent: { // 是否开启点击事件
|
|
type: [Boolean],
|
|
type: [Boolean],
|
|
default: false
|
|
default: false
|
|
|
|
+ },
|
|
|
|
+ updateChartSize: { // 是否需要自动更新图表的大小
|
|
|
|
+ type: [Boolean],
|
|
|
|
+ default: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {},
|
|
components: {},
|
|
@@ -51,12 +55,16 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
this.myChart.setOption(this.options, { notMerge: true });
|
|
this.myChart.setOption(this.options, { notMerge: true });
|
|
|
|
+ if (this.updateChartSize) {
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.myChart.resize(); // 在DOM更新后,调用resize方法更新图表大小
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.uuid = this.idGen();
|
|
this.uuid = this.idGen();
|
|
- console.log(this.uuid, '<===== uuId')
|
|
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.myChart = echarts.init(document.getElementById(this.uuid));
|
|
this.myChart = echarts.init(document.getElementById(this.uuid));
|