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 { .dash-board-item {
flex: 1; flex: 1;
//margin: 24px 12px; //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> </style>

View File

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