- HTML
<html>
<div>
<ul style="overflow-x:auto;" id="元素+下标">
<li>推荐</li>
<li>视频</li>
<li>热点</li>
<li>社会</li>
<li>娱乐</li>
<li>军事</li>
<li>科技</li>
<li>汽车</li>
<li>体育</li>
</ul>
</div>
</html>
- JS
<script>
this.$nextTick(()=>{
// #ifdef H5
try{
// tab添加锚点
document.getElementById('selectItem'+this.current).scrollIntoView({block:'end',behavior: 'smooth'})
}catch(e){
//TODO handle the exception
}
// #endif
})
</script>