const hiddenTextarea = document.createElement("textarea");
hiddenTextarea.style.position = "absolute";
hiddenTextarea.style.left = "-9999px";
hiddenTextarea.setAttribute("readonly", "");
hiddenTextarea.value =‘你要复制的链接’;
document.body.appendChild(hiddenTextarea);
hiddenTextarea.select();
hiddenTextarea.focus();
document.execCommand("copy");
console.log(JSON.stringify(hiddenTextarea), "hiddenTextarea");
showSuccessToast("复制成功");
在ios中 如果是异步拿取的数据的话 那么是复制不上的
解决办法:先执行异步操作 拿到数据后 在执行复制功能