重构目录结构
This commit is contained in:
26
.vitepress/theme/index.ts
Normal file
26
.vitepress/theme/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import {useRoute} from 'vitepress'
|
||||
import {watch, onMounted} from 'vue'
|
||||
|
||||
export default {
|
||||
...DefaultTheme,
|
||||
setup() {
|
||||
const route = useRoute()
|
||||
|
||||
const updateNavVisibility = (path: string) => {
|
||||
const navElement = document.querySelector('.VPNavBarMenu')
|
||||
if (navElement instanceof HTMLElement) {
|
||||
navElement.style.display = (path === '/' || path === '/docs/en/') ? 'none' : ''
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
updateNavVisibility(route.path)
|
||||
})
|
||||
|
||||
// 监听路由变化,处理导航栏显示
|
||||
watch(() => route.path, (path) => {
|
||||
updateNavVisibility(path)
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user