js-复制到粘贴板

130 阅读1分钟
      const inputItem = document.getElementById("copyInputId");
      inputItem.setAttribute("value", val);
      inputItem.select(); // 选择对象
      document.execCommand("Copy");
      alert("复制成功");