我可以像这样设置滚动行为到Vue.js路由器:
- const router = new Router({
- mode: 'history',routes: [
- {
- path: '/',name: 'index',component: Main
- },{
- path: '/some-path',name: 'some-path',component: SomePath
- }
- ],scrollBehavior() {
- return {x: 0,y: 0}
- }
- })
当您单击某个不是最新的页面的链接时,这非常有效.当我点击已经渲染的链接时,即在页脚中,没有任何反应. Vue Router假设没有状态转换.在这种情况下向上滚动的首选方法是什么?