content:爲要設成的文本
// 創建元素用於複製
const aux = document.createElement('input')
// 獲取複製內容
const content = v
// 設置元素內容
aux.setAttribute('value', content)
// 將元素插入頁面進行調用
document.body.appendChild(aux)
// 複製內容
aux.select()
// 將內容複製到剪貼板
document.execCommand('copy')
// 刪除創建元素
document.body.removeChild(aux)
此時內容會被剪切到剪切板