web端实现复制操作 花果山吗喽 2022-04-24 196 阅读1分钟 const tempInput = document.createElement('input'); tempInput.value = [xxx]; document.body.appendChild(tempInput); // 选取输入框的文本内容 tempInput.select(); // 执行浏览器的复制命令 document.execCommand('copy'); // 复制成功后移除input document.body.removeChild(tempInput);