diff --git a/nezha-fronted/src/components/chart/chart/chartText.vue b/nezha-fronted/src/components/chart/chart/chartText.vue index 2a522ab22..e28c36a36 100644 --- a/nezha-fronted/src/components/chart/chart/chartText.vue +++ b/nezha-fronted/src/components/chart/chart/chartText.vue @@ -50,8 +50,15 @@ export default { this.chartInfo.param.oldText = this.chartInfo.param.text }, cancel () { - this.chartInfo.param.isEdit = false - this.chartInfo.param.text = this.chartInfo.param.oldText + if (this.chartInfo.param.oldText) { + this.chartInfo.param.isEdit = false + this.chartInfo.param.text = this.chartInfo.param.oldText + } else { + this.$store.dispatch('dispatchDelChart', { + chart: this.chartInfo, + type: 'delete' + }) + } }, textChange (val) { this.chartInfo.param.text = val