tianyun 2 éve
szülő
commit
dc0a8bbdbd
1 módosított fájl, 1 hozzáadás és 23 törlés
  1. 1 23
      simple-demo/js/util.js

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

@@ -223,28 +223,6 @@ function createEle(eleName, text, attrs) {
     return ele;
 }
 
-/**
- * 复制html内容到剪贴板
- * @param inner_html
- */
-function myCopy(inner_html) {
-    let tmpId = "tmpId123123" + getRandomInt(1, 10000);
-    let a = document.createElement('div');
-    a.id = tmpId;
-    a.innerHTML = inner_html
-    document.querySelector('body').appendChild(a)
-    let range = document.createRange();
-    range.selectNode(document.querySelector("#" + tmpId));
-    // 清除选择
-    window.getSelection().removeAllRanges();
-    window.getSelection().addRange(range);
-    console.log('复制成功');
-    document.execCommand('copy');
-    // 清除选择
-    window.getSelection().removeAllRanges();
-    document.querySelector("#" + tmpId).remove();
-}
-
 
 /**
  * 自动关闭提示框
@@ -356,7 +334,7 @@ const copyUtil = {
                     'text/html': new Blob([html], {type: 'text/html'})
                 })
             ]);
-            alert('复制成功');
+            console.log('复制成功');
         } catch (err) {
             console.error('复制失败', err);
         }