zouling 1 năm trước cách đây
mục cha
commit
1f34a26172
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      ruoyi-ui/src/views/dashboard/GaugeChart.vue

+ 5 - 1
ruoyi-ui/src/views/dashboard/GaugeChart.vue

@@ -26,6 +26,7 @@ export default {
   data() {
     return {
       chart: null,
+      timestr:'',
       option: {
         series: [
           {
@@ -233,7 +234,8 @@ export default {
       this.chart.setOption(this.option)
       // return
       var that=this;
-      setInterval(function () {
+      clearInterval(this.timestr)
+      that.timestr=setInterval(function () {
         var date = new Date();
         var y = date.getFullYear();
         var m = date.getMonth() + 1;
@@ -279,12 +281,14 @@ export default {
         that.chart.setOption(optione);
       }, 1000);
 
+
     })
   },
   beforeDestroy() {
     if (!this.chart) {
       return
     }
+    clearInterval(this.timestr)
     this.chart.dispose()
     this.chart = null
   },