this.act1 = index //点的文字的下标
const floor = document.querySelectorAll(".smallTitle");//获取要滚动区域
const offsetTop = floor[index].offsetTop - 40;
找到滚动条的盒子
this.$refs.boxs.scrollTo({
top: offsetTop,
behavior: "smooth",
});```
vue自己定义滚动
最新推荐文章于 2025-04-01 11:42:34 发布