window.getSelection()了解一下?然后一层一层找父级? var interval; clearInterval(interval); interval = setInterval(()=>{ console.log(window.getSelection(),window.getSelection().anchorNode.textContent.substring(0,window.getSelection().anchorOffset)) },500)
window.getSelection()
了解一下?然后一层一层找父级?