router.beforeEach((to, from, next) => {
const tokenStr = window.sessionStorage.getItem('Tk_token');
if(!tokenStr){
if(to.path==='/user'|| to.path==='/cartShop'){
next('/login');
}else{
window.scroll(0, 0); // <= 这个
next();
}
}else{
window.scroll(0, 0);
next();
}
});
vue 页面跳转还停留在原来高度
最新推荐文章于 2023-02-16 21:30:31 发布