Skip to content

fix(components):Local navigation location error #4393

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(components):update
  • Loading branch information
yuxi-ovo committed Jan 16, 2025
commit b00e2bf548f41979d062b7705e99ffe2a08c12a6
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const open = ref(false)
const vh = ref(0)
const main = ref<HTMLDivElement>()
const items = ref<HTMLDivElement>()
const {hasSidebar} = useSidebar()

Copy link
Contributor

Choose a reason for hiding this comment

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

add blank space.

Suggested change
const { hasSidebar } = useSidebar()

function closeOnClickOutside(e: Event) {
if (!main.value?.contains(e.target as Node)) {
Expand Down Expand Up @@ -61,20 +62,16 @@ function scrollToTop() {
open.value = false
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
}

onMounted(()=>{
const {hasSidebar} = useSidebar()
if(!hasSidebar.value){
document.documentElement.style.setProperty("--vp-sidebar-width","0px")
}
})
</script>

<template>
<div
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 @@ -172,6 +169,9 @@ onMounted(()=>{
left: calc(var(--vp-sidebar-width) + 32px);
width: 320px;
}
.VPLocalNavOutlineDropdown:not(.has-sidebar) .items{
left:32px;
Copy link
Contributor

Choose a reason for hiding this comment

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

add blank space.

Suggested change
left:32px;
.VPLocalNavOutlineDropdown:not(.has-sidebar) .items {

}
}

.header {
Expand Down