修复非安全域复制失败问题

pull/1356/head
地亚尔-IT 2023-08-28 23:47:52 +08:00 committed by GitHub
parent 5bf9cdc72b
commit ae8dede13d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -112,9 +112,17 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
}); });
}); });
} catch(e) { } catch(e) {
layer.msg('复制失败', { var text = document.createElement("textarea");
icon: 2 text.setAttribute("readonly", "readonly");
}); text.value = util.unescape(finalCode);
document.body.appendChild(text);
text.select();
if (document.execCommand("copy")){
layer.msg('已复制', {icon: 1});
}else {
layer.msg('复制失败', {icon: 2});
}
document.body.removeChild(text);
} }
}(); }();
} }