|
@@ -223,28 +223,6 @@ function createEle(eleName, text, attrs) {
|
|
return ele;
|
|
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'})
|
|
'text/html': new Blob([html], {type: 'text/html'})
|
|
})
|
|
})
|
|
]);
|
|
]);
|
|
- alert('复制成功');
|
|
|
|
|
|
+ console.log('复制成功');
|
|
} catch (err) {
|
|
} catch (err) {
|
|
console.error('复制失败', err);
|
|
console.error('复制失败', err);
|
|
}
|
|
}
|