const routers = new Router({ // mode: 'history', base: process.env.BASE_URL, routes: router, scrollBehavior(to, from, savedPosition) { if (savedPosition) { return savedPosition; } else { return { x: 0, y: 0 } } } })
在router里添加 scrollBehavior可以解决