路由滚动行为scrollBehavior

scrollBehavior

history 模式适用

to/from 路由对象
savedPosition 当通过浏览器的 前进/后退 触发
const router = new VueRouter({
  routes: [...],
  scrollBehavior (to, from, savedPosition) {
    // return 期望滚动到哪个的位置
  }
})
原文地址:https://www.cnblogs.com/rainbowqq/p/13397470.html