Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components):Local navigation location error #4393

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { nextTick, ref, watch } from 'vue'
import { useData } from '../composables/data'
import { resolveTitle, type MenuItem } from '../composables/outline'
import VPDocOutlineItem from './VPDocOutlineItem.vue'
import { useSidebar } from '../composables/sidebar'

const props = defineProps<{
headers: MenuItem[]
Expand All @@ -16,6 +17,7 @@ const open = ref(false)
const vh = ref(0)
const main = ref<HTMLDivElement>()
const items = ref<HTMLDivElement>()
const {hasSidebar} = useSidebar()

function closeOnClickOutside(e: Event) {
if (!main.value?.contains(e.target as Node)) {
Expand Down Expand Up @@ -67,6 +69,9 @@ function scrollToTop() {
class="VPLocalNavOutlineDropdown"
:style="{ '--vp-vh': vh + 'px' }"
ref="main"
:class="{
'has-sidebar': hasSidebar,
}"
>
<button @click="toggle" :class="{ open }" v-if="headers.length > 0">
<span class="menu-text">{{ resolveTitle(theme) }}</span>
Expand Down Expand Up @@ -165,6 +170,9 @@ function scrollToTop() {
left: calc(var(--vp-sidebar-width) + 32px);
width: 320px;
}
.VPLocalNavOutlineDropdown:not(.has-sidebar) .items{
left:32px;
}
}

.header {
Expand Down