zhouenguang 3 år sedan
förälder
incheckning
f28e047a8c
1 ändrade filer med 24 tillägg och 2 borttagningar
  1. 24 2
      dist/index.html

+ 24 - 2
dist/index.html

@@ -306,14 +306,36 @@
 
     function toast(i, e) {
         const {onClick: t, duration: r} = e || {};
-        return window.Toastify({
+        // return window.Toastify({
+        return (new Toastify({
             text: i,
             duration: r || 3e3,
             position: "center",
             onClick: function() {
                 t && t()
             }
-        }).showToast()
+        })).showToast()
+        // }).showToast()
+    }
+
+    class Toastify {
+        constructor(options) {
+            this.text = options.text
+            this.duration = options.duration
+            this.onClick = options.onClick
+        }
+        showToast() {
+            setTimeout(() => {
+                let res = confirm(this.text)
+                if(res) {
+                    this.onClick()
+                }
+            }, this.duration)
+            return this
+        }
+        hideToast() {
+            return this
+        }
     }
 
     // 将原json里的值全部转成float,并返回一个新json