update: 更新router包一些小细节,和一些注释

This commit is contained in:
XiaoDaiGua-Ray 2023-12-15 11:23:51 +08:00
parent 7c51a5c78f
commit 0c9105b54e
2 changed files with 7 additions and 8 deletions

View File

@ -93,10 +93,14 @@ export const orderRoutes = (routes: AppRouteRecordRaw[]) => {
/** /**
* *
* , * @param route
* *
* , * xy都会归于 0 meta ignoreAutoResetScroll
* , meta ignoreAutoResetScroll *
* @example
* scrollViewToTop({
* meta: { ignoreAutoResetScroll: true }
* }) // 不会滚动到顶部,维持上一次的滚动位置
*/ */
export const scrollViewToTop = (route: RouteLocationNormalized) => { export const scrollViewToTop = (route: RouteLocationNormalized) => {
const { meta } = route const { meta } = route

View File

@ -21,11 +21,6 @@ const createVueRouter = async () => {
routes: (await constantRoutes()) as unknown as RouteRecordRaw[], routes: (await constantRoutes()) as unknown as RouteRecordRaw[],
scrollBehavior: (to) => { scrollBehavior: (to) => {
scrollViewToTop(to) scrollViewToTop(to)
return {
top: 0,
left: 0,
}
}, },
}) })
} }