Procházet zdrojové kódy

优化复制功能

leo před 1 rokem
rodič
revize
ec6fb2e3fa
1 změnil soubory, kde provedl 0 přidání a 35 odebrání
  1. 0 35
      plugins/plugins.js

+ 0 - 35
plugins/plugins.js

@@ -13,39 +13,4 @@ export function timeStamp(StatusMinute, userCardType, nextSendTime) {
         StatusMinute += parseFloat(min) + '分钟';
     }
     return StatusMinute.length ? StatusMinute : userCardType === 1 ? '0小时' : '';
-}
-
-
-// 封装对剪贴板的访问为异步函数
-export function writeToClipboard(text, success = () => { }, error = () => { }) {
-    // 如果navigator.clipboard存在,直接使用复制功能
-    if (navigator.clipboard) {
-        try {
-            setTimeout(() => {
-                navigator.clipboard.writeText(text).then(() => {
-                    success()
-                }).catch((err) => {
-                    error()
-                })
-            }, 0);
-        } catch (err) {
-            error()
-        }
-    } else {
-        const textArea = document.createElement('textarea');
-        textArea.value = text;
-        document.body.appendChild(textArea);
-        textArea.select();
-        try {
-            const successful = document.execCommand('copy');
-            if (successful) {
-                success()
-            } else {
-                throw '复制失败'
-            }
-        } catch (err) {
-            error()
-        }
-        document.body.removeChild(textArea);
-    }
 }