【发布时间】:2018-10-31 03:02:15
【问题描述】:
我可以像这样为 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 假设没有状态转换。在这种情况下,向上滚动的首选方式是什么?
【问题讨论】:
标签: vue.js vue-router