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

pull/1356/head
地亚尔-IT 1 year ago committed by GitHub
parent 5bf9cdc72b
commit ae8dede13d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -112,9 +112,17 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
});
});
} catch(e) {
layer.msg('复制失败', {
icon: 2
});
var text = document.createElement("textarea");
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);
}
}();
}

Loading…
Cancel
Save