const headingGroup = this.$refs.preview.$el.querySelectorAll('h1,h2,h3,h4,h5,h6')
for (let i = 0; i < headingGroup.length; ++i) {
if (headingGroup[i].innerText === (anchor.title)) {
headingGroup[i].scrollIntoView({
behavior: 'smooth',
block: 'start'
})
}
Enumeration can be used to implement the mouse click anchor function in vue
When clicking a certain title, you can directly call the above code to move the browser focus to the target area
For the way of accessing NodeList: direct array subscript index is enough.