فهرست منبع

修改重复提示问题

bill 2 سال پیش
والد
کامیت
ceae24f460
1فایلهای تغییر یافته به همراه13 افزوده شده و 1 حذف شده
  1. 13 1
      src/graphic/Service/UIService.js

+ 13 - 1
src/graphic/Service/UIService.js

@@ -287,8 +287,20 @@ export default class UIService {
     return newPosition;
     return newPosition;
   }
   }
 
 
+  currentShowMsgs = [];
   prompt(msg) {
   prompt(msg) {
-    Message.success(typeof msg === "string" ? { msg } : msg);
+    const config = typeof msg === "string" ? { msg, time: 1000 } : msg;
+    if (this.currentShowMsgs.includes(config.msg)) {
+      return;
+    }
+
+    this.currentShowMsgs.push(config.msg);
+    setTimeout(() => {
+      this.currentShowMsgs = this.currentShowMsgs.filter(
+        (msg) => msg !== config.msg
+      );
+    }, config.time);
+    Message.success(config);
   }
   }
 }
 }