直接上代码:
javascript
const url = '要复制的内容';
var aux = document.createElement("input");
aux.setAttribute("value", url);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
效果图:
