fix: nav 重复显示
This commit is contained in:
parent
31fb97ed3c
commit
3699b01799
@ -3,6 +3,7 @@ module.exports = {
|
||||
extends: 'vuepress',
|
||||
globals: {
|
||||
__VUEPRESS_VERSION__: 'readonly',
|
||||
__VUEPRESS_BASE__: 'readonly',
|
||||
__VUEPRESS_DEV__: 'readonly',
|
||||
__VUEPRESS_SSR__: 'readonly',
|
||||
__VUE_HMR_RUNTIME__: 'readonly',
|
||||
@ -11,16 +12,15 @@ module.exports = {
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.vue'],
|
||||
files: ['*.ts', '*.vue', '*.cts'],
|
||||
extends: 'vuepress-typescript',
|
||||
parserOptions: {
|
||||
project: ['tsconfig.json'],
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'vue/component-tags-order': [
|
||||
'error',
|
||||
@ -28,22 +28,10 @@ module.exports = {
|
||||
order: ['script', 'template', 'style'],
|
||||
},
|
||||
],
|
||||
'vue/multi-word-component-names': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.vue'],
|
||||
globals: {
|
||||
defineEmits: 'readonly',
|
||||
defineProps: 'readonly',
|
||||
},
|
||||
rules: {
|
||||
// disable for setup script
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['clientConfig.ts'],
|
||||
files: ['**/client/config.ts'],
|
||||
rules: {
|
||||
'vue/match-component-file-name': 'off',
|
||||
},
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
"typescript": "^5.0.4",
|
||||
"vite": "^4.2.1"
|
||||
},
|
||||
"packageManager": "pnpm@7.13.4",
|
||||
"packageManager": "pnpm@7.32.0",
|
||||
"engines": {
|
||||
"node": ">=16",
|
||||
"pnpm": ">=7"
|
||||
|
||||
@ -12,7 +12,7 @@ const props = defineProps<{
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const tag = computed(() => (props.tag ?? props.href ? 'a' : 'span'))
|
||||
const tag = computed(() => props.tag ?? (props.href ? 'a' : 'span'))
|
||||
const isExternal = computed(
|
||||
() => props.href && EXTERNAL_URL_RE.test(props.href)
|
||||
)
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import { defineClientConfig } from '@vuepress/client'
|
||||
import { h } from 'vue'
|
||||
import Badge from './components/global/Badge.vue'
|
||||
import { setupDarkMode } from './composables/index.js'
|
||||
import { setupDarkMode, useScrollPromise } from './composables/index.js'
|
||||
import Layout from './layouts/Layout.vue'
|
||||
import NotFound from './layouts/NotFound.vue'
|
||||
|
||||
import './styles/index.scss'
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance({ app }) {
|
||||
enhance({ app, router }) {
|
||||
// global component
|
||||
// eslint-disable-next-line vue/match-component-file-name
|
||||
app.component('Badge', Badge)
|
||||
@ -40,6 +40,13 @@ export default defineClientConfig({
|
||||
}
|
||||
return null
|
||||
})
|
||||
|
||||
// handle scrollBehavior with transition
|
||||
const scrollBehavior = router.options.scrollBehavior!
|
||||
router.options.scrollBehavior = async (...args) => {
|
||||
await useScrollPromise().wait()
|
||||
return scrollBehavior(...args)
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
setupDarkMode()
|
||||
|
||||
@ -15,7 +15,7 @@ import SkipLink from '../components/SkipLink.vue'
|
||||
import VFooter from '../components/VFooter.vue'
|
||||
import {
|
||||
useCloseSidebarOnEscape,
|
||||
useScrollPromise,
|
||||
// useScrollPromise,
|
||||
useSidebar,
|
||||
} from '../composables/index.js'
|
||||
|
||||
@ -36,9 +36,9 @@ provide('close-sidebar', closeSidebar)
|
||||
provide('is-sidebar-open', isSidebarOpen)
|
||||
|
||||
// handle scrollBehavior with transition
|
||||
const scrollPromise = useScrollPromise()
|
||||
const onBeforeEnter = scrollPromise.resolve
|
||||
const onBeforeLeave = scrollPromise.pending
|
||||
// const scrollPromise = useScrollPromise()
|
||||
// const onBeforeEnter = scrollPromise.resolve
|
||||
// const onBeforeLeave = scrollPromise.pending
|
||||
</script>
|
||||
<template>
|
||||
<div class="theme-plume">
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"module": "ES2020",
|
||||
"baseUrl": ".",
|
||||
"jsx": "preserve",
|
||||
"paths": {
|
||||
"@theme-plume/*": ["./packages/theme/src/client/components/*"],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user