fix: bug#13648

This commit is contained in:
xieyonghong 2023-05-15 10:43:22 +08:00
parent 4bb50a9ebc
commit 617cd8b76b
2 changed files with 23 additions and 7 deletions

View File

@ -157,7 +157,15 @@ watch(
.dash-board-item {
flex: 1;
//margin: 24px 12px;
min-width: 250px;
min-width: calc(25% - 24px);
}
}
@media (max-width: 1400px) {
.dash-board {
.dash-board-item {
min-width: calc(50% - 24px);
}
}
}
</style>

View File

@ -43,19 +43,27 @@ export default {
data() {
return {
options: {},
myChart: undefined
};
},
beforeDestroy() {
window.removeEventListener('resize', this.resize)
},
methods: {
createChart(val) {
const chart = this.$refs.chartRef;
if (chart && Object.keys(val).length > 0) {
const myChart = echarts.init(chart);
myChart.setOption(val);
window.addEventListener('resize', function () {
myChart.resize();
});
if (chart && Object.keys(val).length > 0 && !this.myChart) {
console.log('createChart')
this.myChart = echarts.init(chart);
this.myChart.setOption(val);
window.addEventListener('resize', this.resize);
} else if (this.myChart) {
this.myChart.setOption(val);
}
},
resize() {
this.myChart?.resize();
},
getOptions(max, formatter, val) {
let formatterCount = 0;
this.options = {