mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-12-20 17:55:40 +08:00
feat: 定期检查文档更新并弹出提醒
- 扩展基础主题代码做抽取
This commit is contained in:
@@ -1,35 +1,19 @@
|
||||
import type { EnhanceAppContext } from 'vitepress'
|
||||
import { Theme } from 'vitepress'
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import { nextTick, watch } from 'vue'
|
||||
import { inBrowser, useRoute } from 'vitepress'
|
||||
import mediumZoom from 'medium-zoom'
|
||||
|
||||
import Title from '../components/Title.vue'
|
||||
import ImgSlider from '../components/ImgSlider.vue'
|
||||
|
||||
import { refresh } from './refresh'
|
||||
import { customComponents } from './customComponents'
|
||||
import Layout from './Layout.vue'
|
||||
import './index.css'
|
||||
|
||||
export default {
|
||||
const theme: Theme = {
|
||||
...DefaultTheme,
|
||||
enhanceApp(ctx: EnhanceAppContext) {
|
||||
// 使用默认主题的增强应用程序功能
|
||||
Layout,
|
||||
enhanceApp(ctx) {
|
||||
DefaultTheme.enhanceApp(ctx)
|
||||
|
||||
// 注册组件
|
||||
const { app } = ctx
|
||||
app.component('Title', Title)
|
||||
app.component('ImgSlider', ImgSlider)
|
||||
},
|
||||
setup() {
|
||||
const route = useRoute()
|
||||
watch(
|
||||
() => route.path,
|
||||
() => {
|
||||
nextTick(() =>
|
||||
inBrowser ? mediumZoom('.main img', { background: 'var(--vp-c-bg)' }) : null
|
||||
)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
app.use(refresh).use(customComponents)
|
||||
}
|
||||
}
|
||||
|
||||
export default theme
|
||||
|
||||
Reference in New Issue
Block a user