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-03-20 22:50:16 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d22cb6c2446fbfb0de27eb4b56ad5947dbe628c0
d22cb6c2
1 parent
f33520a8
feat(router): 添加路由切换后页面滚动到顶部的功能
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
src/router/index.js
src/router/index.js
View file @
d22cb6c
/*
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-20 2
1:47:32
* @LastEditTime: 2025-03-20 2
2:46:37
* @FilePath: /mlaj/src/router/index.js
* @Description: 文件描述
*/
...
...
@@ -69,6 +69,10 @@ const routes = [
const
router
=
createRouter
({
history
:
createWebHistory
(),
routes
,
scrollBehavior
(
to
,
from
,
savedPosition
)
{
// 每次路由切换后,页面滚动到顶部
return
savedPosition
||
{
top
:
0
,
left
:
0
}
}
})
export
default
router
...
...
Please
register
or
login
to post a comment