优化详情返回首页停留
This commit is contained in:
@@ -14,6 +14,15 @@ import { sellerRoutes } from './sellerRoutes'
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [...adminRoutes, ...mobileRoutes, ...publicRoutes, ...accountRoutes, ...sellerRoutes],
|
||||
scrollBehavior(to, _from, savedPosition) {
|
||||
// 浏览器前进/后退优先用历史滚动位置
|
||||
if (savedPosition) return savedPosition
|
||||
// 移动端首页由 KeepAlive + 组件内自行恢复滚动,避免被强制拉回顶部
|
||||
if (to.name === 'mobile-home' || to.name === 'mobile-listings') {
|
||||
return false
|
||||
}
|
||||
return { left: 0, top: 0 }
|
||||
},
|
||||
})
|
||||
|
||||
router.beforeEach(async to => {
|
||||
|
||||
Reference in New Issue
Block a user