选择元素的文本内容 以下方法选择 ele 元素的文本内容: const selectText = function (ele) { const selection = window.getSelection() const range = document.createRange() range.selectNodeContents(ele) selection.removeAllRanges() selection.addRange(range) }