1
0
mirror of https://github.com/sendevia/website.git synced 2026-03-08 16:52:34 +08:00
Files
website/.vitepress/theme/components/ScrollToTop.vue

22 lines
656 B
Vue

<script setup lang="ts">
import { useGlobalScroll } from "../composables/useGlobalScroll";
const { isScrolled } = useGlobalScroll({ threshold: 500 });
function scrollToTop() {
const container = document.getElementById("layout-content-flow");
(container as HTMLElement).scrollTo({ top: 0, behavior: "smooth" });
}
</script>
<template>
<div id="layout-scrolltop" :class="{ visible: isScrolled }">
<span id="scrolltop-button" role="button" aria-label="Scroll to top" @click="scrollToTop"> arrow_upward </span>
</div>
</template>
<style lang="scss" scoped>
@use "sass:meta";
@include meta.load-css("../styles/components/ScrollToTop");
</style>