diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index e07071f3f..fc0836e3e 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -497,17 +497,19 @@ export default { } }, preview (show) { + this.previewShow = show if (show) { - const start = new Date().setHours(new Date().getHours() - 1) - const end = new Date() - this.timeRange = [bus.computeTimezoneTime(start), bus.computeTimezoneTime(end)] - this.prevChart = lodash.cloneDeep(this.editChart) - this.prevChart.loaded = true - this.prevChart.param.showHeader = true + this.$nextTick(() => { + const start = new Date().setHours(new Date().getHours() - 1) + const end = new Date() + this.timeRange = [bus.computeTimezoneTime(start), bus.computeTimezoneTime(end)] + setTimeout(() => { + this.prevChart = lodash.cloneDeep(this.editChart) + this.prevChart.loaded = true + this.prevChart.param.showHeader = true + }) + }) } - this.$nextTick(() => { - this.previewShow = show - }) } }, created () {