Skip to content

Commit

Permalink
feat(vitepress): 注册 MNavLinks 为全局组件
Browse files Browse the repository at this point in the history
  • Loading branch information
maomao1996 committed Dec 26, 2023
1 parent e9b1b54 commit 2e3f4fb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed } from 'vue'
import { withBase } from 'vitepress'
import { slugify } from '@mdit-vue/shared'
import { NavLink } from './type'
import { NavLink } from '../types'
const props = defineProps<{
icon?: NavLink['icon']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed } from 'vue'
import { slugify } from '@mdit-vue/shared'
import MNavLink from './MNavLink.vue'
import type { NavLink } from './type'
import type { NavLink } from '../types'
const props = defineProps<{
title: string
Expand Down
4 changes: 4 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import DefaultTheme from 'vitepress/theme'

import { createMediumZoomProvider } from './composables/useMediumZoom'

import MNavLinks from './components/MNavLinks.vue'

import './styles/index.scss'

let homePageStyle: HTMLStyleElement | undefined
Expand All @@ -25,6 +27,8 @@ export default {
enhanceApp({ app, router }: EnhanceAppContext) {
createMediumZoomProvider(app, router)

app.component('MNavLinks', MNavLinks)

if (typeof window !== 'undefined') {
watch(
() => router.route.data.relativePath,
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions docs/nav/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ outline: [2, 3, 4]
---

<script setup>
import MNavLinks from './components/MNavLinks.vue'

import { NAV_DATA } from './data'
</script>
<style src="./index.scss"></style>
Expand Down

1 comment on commit 2e3f4fb

@vercel
Copy link

@vercel vercel bot commented on 2e3f4fb Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.