方式一:
//方式一:支持http
let str= "aaaaa" const copyInput = document.createElement('input'); copyInput.value = str; document.body.appendChild(copyInput); copyInput.select(); document.execCommand('Copy');
//方式二:不支持http
let textValue= "aaaaa"
navigator?.clipboard ?.writeText(textValue) .then(() => { message.success('复制成功'); }) .catch(() => { message.error('复制失败'); });
标签:常用,http,copyInput,js,复制,message,document From: https://www.cnblogs.com/cb1490838281/p/17807755.html