use extends

userquin/feat-allow-use-components-in-nav-item
Divyansh Singh 2 days ago
parent 295cc27407
commit f0369f46ae

@ -3,7 +3,7 @@ import DefaultTheme from 'vitepress/theme'
import CustomAppearance from './CustomAppearance.vue'
export default {
...DefaultTheme,
extends: DefaultTheme,
enhanceApp({ app }) {
app.component('CustomAppearance', CustomAppearance)
}

@ -192,14 +192,17 @@ Then, you need to register the component globally:
```js
// .vitepress/theme/index.js
import AnotherCustomComponent from './components/AnotherCustomComponent.vue'
import DefaultTheme from 'vitepress/theme'
import MyCustomComponent from './components/MyCustomComponent.vue'
import AnotherCustomComponent from './components/AnotherCustomComponent.vue'
/** @type {import('vitepress').Theme} */
export default {
extends: DefaultTheme,
enhanceApp({ app }) {
app.component('AnotherCustomComponent', AnotherCustomComponent)
app.component('MyCustomComponent', MyCustomComponent)
app.component('AnotherCustomComponent', AnotherCustomComponent)
}
}
```

Loading…
Cancel
Save