template
<div id="anchor" class="level-arrow" v-if="currentId === (index * 5 + subIndex + 1)"></div>
class="level-arrow" v-if="currentId === (index * 5 + subIndex + 1)"这些可以去掉哈
js
this.$nextTick(() => {
document.querySelector('#anchor').scrollIntoView({ behavior: 'smooth',
block: 'center', inline: 'center' })
})
behavior: 'smooth'在Safari上是没有平滑定位的效果的,安卓有
如果与动态数据渲染无关可以不加this.$nextTick
block: 'center', inline: 'center'两个主要是让锚点定位的位置居中