路由配置meta: { keepAlive: true, scrollTop: 0,}router.beforeEach((to: Route, from: Route, next: () => void) => { if (from.meta.keepAlive && from.meta.scrollTop >= 0) { const $content = document.querySelector('#scroll_content'); // 可以用其他方式获取 const scrollTop = $content ? $content.scrollTop : 0; from.meta.scrollTop = scrollTop; } next();}); 页面恢复if (this.$route.meta.scrollTop > 0) { const content: any = document.querySelector('#scroll_content'); content.scrollTop = this.$route.meta.scrollTop;}