JS 点击复制到剪贴板
in 默认分类 with 0 comment

JS 点击复制到剪贴板

in 默认分类 with 0 comment
function Copy(str) {
    var save = function(e) {
        e.clipboardData.setData('text/plain', str);
        e.preventDefault();
    };
    document.addEventListener('copy', save);
    document.execCommand('copy');
    document.removeEventListener('copy', save);
    console.log('复制成功');
}
Responses