废话少说,放码过来。
function copy_to_clipboard(txt_str){
const input = document.createElement('input');
document.body.appendChild(input);
input.setAttribute('value', txt_str);
input.select();
if (document.execCommand('copy')) {
document.execCommand('copy');
console.log('复制成功');
//Alert(500,'复制成功');
}
document.body.removeChild(input);
}