38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import DefaultTheme from 'vitepress/theme'
|
|
import Confetti from "./components/Confetti.vue";
|
|
import ArticleMetadata from "./components/ArticleMetadata.vue"
|
|
import StatsChart from './components/StatsChart.vue'
|
|
import type { EnhanceAppContext } from 'vitepress'
|
|
import { onMounted, watch, nextTick } from 'vue'
|
|
import { useRoute } from 'vitepress'
|
|
import mediumZoom from 'medium-zoom'
|
|
import '../theme/style.css'
|
|
import './style/var.css'
|
|
import './style/vp-code.css'
|
|
import './style/custom-block.css'
|
|
import MyLayout from './components/MyLayout.vue';
|
|
|
|
export default {
|
|
extends: DefaultTheme,
|
|
Layout: MyLayout,
|
|
setup() {
|
|
const route = useRoute()
|
|
const initZoom = () => {
|
|
// 为所有图片增加缩放功能
|
|
mediumZoom('.main img', { background: 'var(--vp-c-bg)' })
|
|
}
|
|
onMounted(() => {
|
|
initZoom()
|
|
})
|
|
watch(
|
|
() => route.path,
|
|
() => nextTick(() => initZoom())
|
|
)
|
|
},
|
|
enhanceApp({ app }: EnhanceAppContext) {
|
|
app.component("Confetti", Confetti);
|
|
app.component("StatsChart", StatsChart);
|
|
app.component("ArticleMetadata", ArticleMetadata);
|
|
},
|
|
};
|