diff --git a/src/App.vue b/src/App.vue
index 395369b..fe0e78a 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -21,7 +21,7 @@
-
+
@@ -35,7 +35,7 @@
-
+
@@ -74,7 +74,7 @@ import api from '@/api'
import { sendWarningMessage } from '@/utils/message'
import { logout } from '@/utils/profile'
import router from '@router'
-import { useRoute } from 'vue-router'
+import { useRoute, useRouter } from 'vue-router'
// 手机状态下收缩菜单栏
const collapsed = ref(true)
@@ -84,6 +84,7 @@ if (document.body.clientWidth >= 1000) {
const osThemeRef = useOsTheme()
const route = useRoute()
+const vRouter = useRouter()
const theme = computed(() => (osThemeRef.value === 'dark' ? darkTheme : null))
// let initFinished = false
@@ -91,10 +92,15 @@ const loading = ref(true)
const tokenValid = ref(false)
const showGuestSidebar = ref(false)
const showMainSidebar = ref(false)
+const contentRef = ref(null)
hljs.registerLanguage('ini', ini)
hljs.registerLanguage('nginx', nginx)
+vRouter.afterEach(() => {
+ contentRef.value?.scrollTo({ top: 0, behavior: 'smooth' })
+})
+
// function getMessage(e) {
// const rs = JSON.parse(e.data)
// // 通知
diff --git a/src/components/sidebar/GuestSidebar.vue b/src/components/sidebar/GuestSidebar.vue
index 7f87db7..95fda11 100644
--- a/src/components/sidebar/GuestSidebar.vue
+++ b/src/components/sidebar/GuestSidebar.vue
@@ -7,7 +7,7 @@
@expand="collapsed = false"
collapse-mode="width"
:collapsed-width="64"
- :native-scrollbar="true"
+ :native-scrollbar="false"
id="sider"
style="height: 100%; bottom: 0"
>
diff --git a/src/components/sidebar/MainSidebar.vue b/src/components/sidebar/MainSidebar.vue
index b6cb5a9..4cf5c5a 100644
--- a/src/components/sidebar/MainSidebar.vue
+++ b/src/components/sidebar/MainSidebar.vue
@@ -7,8 +7,7 @@
@expand="collapsed = false"
collapse-mode="width"
:collapsed-width="64"
- :native-scrollbar="true"
- :inverted="false"
+ :native-scrollbar="false"
id="sider"
style="height: 100%; bottom: 0"
>
diff --git a/src/router/index.js b/src/router/index.js
index 4f80c65..34b13d8 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -284,13 +284,7 @@ const routes = [
const router = createRouter({
history: createWebHistory(),
- routes,
- scrollBehavior(to, from, savedPosition) {
- return {
- top: 0,
- behavior: 'smooth'
- }
- }
+ routes
})
// // 检查本地存储是否存在token,若存在则直接使用