路由滚动行为scrollBehavior

scrollBehavior

history 模式适用

to/from 路由对象
savedPosition 当通过浏览器的 前进/后退 触发
const router = new VueRouter({
  routes: [...],
  scrollBehavior (to, from, savedPosition) {
    // return 期望滚动到哪个的位置
  }
})
posted @ 2020-07-29 15:33  文件传输助手01  阅读(501)  评论(0编辑  收藏  举报