第一种方法:
1.css
html,body { /* scroll-behavior: smooth; */ }
2.js

document.documentElement.scrollTop = document.body.scrollTop =  this.vdaH;

第二种方法
js

//downLoaction指定位置的id
this.$el.querySelector(`#downLoaction`).scrollIntoView({
  behavior: "smooth",  // 平滑过渡
  block:    "start"  // 上边框与视窗顶部平齐。默认值
});
Logo

前往低代码交流专区

更多推荐