Browse Source

bugfix:提交测试代码

leo 1 year ago
parent
commit
cb1c874ee6
1 changed files with 6 additions and 0 deletions
  1. 6 0
      plugins/plugins.js

+ 6 - 0
plugins/plugins.js

@@ -21,8 +21,12 @@ export async function writeToClipboard(text) {
     // 如果navigator.clipboard存在,直接使用复制功能
     if (navigator.clipboard) {
         try {
+            alert(1)
+            alert(text)
             await navigator.clipboard.writeText(text);
         } catch (err) {
+            alert(2)
+            alert(err)
             throw err
         }
     } else {
@@ -34,7 +38,9 @@ export async function writeToClipboard(text) {
         try {
             const successful = document.execCommand('copy');
             if (successful) {
+                alert(3)
             } else {
+                alert(4)
                 throw '复制失败'
             }
         } catch (err) {