tianyun há 1 ano atrás
pai
commit
ab1d54ac33
1 ficheiros alterados com 33 adições e 1 exclusões
  1. 33 1
      simple-demo/js/util.js

+ 33 - 1
simple-demo/js/util.js

@@ -474,4 +474,36 @@ function monitorAndAct(func1, func2) {
 
     // 启动检查过程
     checkValue();
-}
+}
+
+function showTextOnTopRight(text) {
+    let id1 = "showTextOnTopRight";
+    // 删除之前的
+    let oldDiv = document.getElementById(id1);
+    if (oldDiv) {
+        document.body.removeChild(oldDiv);
+    }
+    // 在屏幕右上角显示一个文本
+    let div = document.createElement("div");
+    // 设置id
+    div.id = id1;
+    div.style.position = "fixed";
+    div.style.top = "8px";
+    div.style.right = "8px";
+    div.style.padding = "5px";
+    div.style.backgroundColor = "#fff";
+    div.style.border = "1px solid #ccc";
+    div.style.borderRadius = "5px";
+    div.style.zIndex = "9999";
+    // 字体大小
+    div.style.fontSize = "12px";
+    div.innerHTML = text;
+    document.body.appendChild(div);
+}
+
+function showBusyText() {
+    showTextOnTopRight("同步中...");
+}
+function showDoneText() {
+    showTextOnTopRight("已同步");
+}