feat: add scroll to top button in VPDocAsideOutline component

pull/4522/head
Hichem Fantar 8 months ago
parent 8b3e10cb99
commit 30e8c5feab

@ -22,6 +22,11 @@ const container = ref()
const marker = ref() const marker = ref()
useActiveAnchor(container, marker) useActiveAnchor(container, marker)
function scrollToTop() {
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
}
</script> </script>
<template> <template>
@ -44,6 +49,11 @@ useActiveAnchor(container, marker)
</div> </div>
<VPDocOutlineItem :headers="headers" :root="true" /> <VPDocOutlineItem :headers="headers" :root="true" />
<button @click="scrollToTop">
<span>{{ theme.returnToTopLabel || 'Return to top' }}</span>
</button>
</div> </div>
</nav> </nav>
</template> </template>

Loading…
Cancel
Save