|
|
@@ -1,6 +1,6 @@
|
|
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
|
/* eslint-disable @typescript-eslint/no-base-to-string */
|
|
|
-import { createRouter, createWebHashHistory, type RouteRecordRaw } from "vue-router"
|
|
|
+import { createRouter, createWebHistory, type RouteRecordRaw } from "vue-router"
|
|
|
import appStore from "@s"
|
|
|
import configs from "@@/config"
|
|
|
import JwtService from "@@/services/JwtService"
|
|
|
@@ -103,13 +103,20 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|
|
]
|
|
|
|
|
|
const router = createRouter({
|
|
|
- history: createWebHashHistory(),
|
|
|
+ //history: createWebHashHistory(),
|
|
|
+ history: createWebHistory(),
|
|
|
routes: constantRoutes,
|
|
|
- scrollBehavior(_to, _from, savedPosition) {
|
|
|
+ scrollBehavior(to, _from, savedPosition) {
|
|
|
if (savedPosition) {
|
|
|
return savedPosition
|
|
|
+ } else if (to.hash) {
|
|
|
+ return {
|
|
|
+ el: to.hash,
|
|
|
+ top: 80,
|
|
|
+ behavior: "smooth"
|
|
|
+ }
|
|
|
} else {
|
|
|
- return { top: 0 }
|
|
|
+ return { top: 0, left: 0, behavior: "smooth" }
|
|
|
}
|
|
|
}
|
|
|
})
|