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-11 22:57:52 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
34b06010d633d60785438500d27a5a27dcd4d33b
34b06010
1 parent
e42063c0
refactor(router): 移除默认的滚动行为配置
导航时不再强制滚动到顶部,交由浏览器默认行为处理
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 @
34b0601
/*
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-0
3-25 15:17:18
* @LastEditTime: 2025-0
6-11 22:57:00
* @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