vue 锚点定位 一种方法

import BScroll from "better-scroll";

selectkey(index){

获取右侧所有元素的 classname
const citylist = this.$refs.area_scroll.getElementsByClassName(
"citylist"
);
// 根据下标,滚动到相对应的元素上
let el = citylist[index];
// 滚动到对应的位置上
this.scroll.scrollToElement(el, 250);

}

原文地址:https://www.cnblogs.com/xzhce/p/13679984.html