JS

function copywx() { const range = document.createRange(); range.selectNode(document.getElementById('copy_content')); const selection = window.getSelection(); if (selection.rangeCount > 0) selection.removeAllRanges(); selection.addRange(range); document.execCommand('copy'); alert(" 复制成功!") }
其中可以打印 range 出来看看复制的内容。