Open gitakachan opened 2 years ago
//router/index.js const router = createRouter({ //... }); router.beforeEach((to, from, next) => { // 让页面回到顶部 document.documentElement.scrollTop = 0; // 一定不要忘记调用 next() next(); });