0
点赞
收藏
分享

微信扫一扫

js实现复制功能

船长_Kevin 2022-08-03 阅读 174


var oInput = document.getElementById('input');
oInput.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
message.success("复制成功", 1);

var dummy = document.createElement('input');
text = window.location.href;
document.body.appendChild(dummy);
dummy.value = text;
dummy.select(); // 选择对象
document.execCommand('copy'); // 执行浏览器复制命令
document.body.removeChild(dummy);


举报

相关推荐

0 条评论