This commit is contained in:
maropboia 2024-05-03 11:38:47 +06:00
parent 228d89ca23
commit 2a3ec130dd

View file

@ -1,24 +1,30 @@
import { type Theme } from 'vitepress' // Import the Theme type from VitePress // Import the necessary modules and components
import DefaultTheme from 'vitepress/theme' // Import the default VitePress theme import { type Theme } from 'vitepress'
import Layout from './Layout.vue' // Import the custom layout component import DefaultTheme from 'vitepress/theme'
import Post from './PostLayout.vue' // Import the custom post layout component import Layout from './Layout.vue'
import { loadProgress } from './composables/nprogress' // Import the loadProgress function import Post from './PostLayout.vue'
import './style.css' // Import the custom global CSS styles import { loadProgress } from './composables/nprogress'
import 'uno.css' // Import the uno.css library import './style.css'
import 'uno.css'
// The custom VitePress theme // Define the custom VitePress theme
export default { export default {
// Extend the default VitePress theme
extends: DefaultTheme, extends: DefaultTheme,
// Use the custom layout component
Layout, Layout,
// Use the custom post layout component
Post, Post,
// The enhanceApp function is called after the VitePress app is mounted // Add a setup function to configure the theme
enhanceApp({ router, app }) { setup() {
// Add the custom post layout component to the VitePress app // Call the enhanceApp function to add the custom post layout component and load the progress bar
app.component('Post', Post) this.enhanceApp({
// Call the loadProgress function with the router object as an argument router: this.router,
loadProgress(router) app: this.app,
// Define the mount function to be called after the VitePress app is mounted
mount(app) {
// Add the custom post layout component to the VitePress app
app.component('Post', Post)
// Call the loadProgress function with the router object as an argument
loadProgress(this.router)
}
})
} }
} satisfies Theme } satisfies Theme