You are viewing a single comment's thread from:

RE: JavaScript开发笔记

in #starnoteyesterday
const copyText = () => {
  const text = "Hello, Clipboard API!"
  navigator.clipboard
    .writeText(text)
    .then(() => {
      console.log("Text copied to clipboard")
    })
    .catch((error) => {
      console.error("Failed to copy text: ", error)
    })
}