junyi-h5-copy.js 436 B

123456789101112
  1. export default function h5Copy(content) {
  2. let input = document.createElement("input");
  3. input.value = content;
  4. input.readOnly = true;
  5. document.body.appendChild(input);
  6. input.select(); // 选择对象
  7. input.setSelectionRange(0, content.length); //核心
  8. let result = document.execCommand("Copy"); // 执行浏览器复制命令
  9. input.remove();
  10. return result;
  11. }
  12. //# sourceMappingURL=junyi-h5-copy.js.map