Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-06-12 10:37:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
45f88b97197a85799bf8a711997e4c62b7c564b2
45f88b97
1 parent
34b06010
fix(router): 启用路由切换后滚动到顶部的行为
恢复被注释的scrollBehavior功能,确保每次路由切换后页面能正确滚动到顶部,提升用户体验
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
src/router/index.js
src/router/index.js
View file @
45f88b9
/*
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-06-1
1 22:57:00
* @LastEditTime: 2025-06-1
2 10:37:19
* @FilePath: /mlaj/src/router/index.js
* @Description: 路由实例创建和导出
*/
...
...
@@ -12,10 +12,10 @@ import { checkWxAuth, checkAuth } from './guards'
const
router
=
createRouter
({
history
:
createWebHashHistory
(
import
.
meta
.
env
.
VITE_BASE
||
'/'
),
routes
,
//
scrollBehavior(to, from, savedPosition) {
//
// 每次路由切换后,页面滚动到顶部
//
return savedPosition || { top: 0, left: 0 }
//
},
scrollBehavior
(
to
,
from
,
savedPosition
)
{
// 每次路由切换后,页面滚动到顶部
return
savedPosition
||
{
top
:
0
,
left
:
0
}
},
})
// 导航守卫
...
...
Please
register
or
login
to post a comment