Skip to content

Commit

Permalink
feat: 回到顶部按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
wsvaio committed Apr 17, 2024
1 parent 2c9caba commit 757d509
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions layouts/default/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import BannerView from "./views/banner/index.vue";
import MainView from "./views/main/index.vue";
defineProps<{ bannerHeight?: string; bannerTitle: string }>();
const { y } = useWindowScroll();
</script>

<template>
Expand All @@ -17,4 +19,15 @@ defineProps<{ bannerHeight?: string; bannerTitle: string }>();

<slot />
</main-view>
<transition name="fade">
<button
v-if="y >= 512" pos="fixed right-1em bottom-1em" z="10" border="none"
text="2em"
class="i-fxemoji:rocket"
p="0"
rotate="[-45deg]"
cursor="pointer"
@click="y = 0"
/>
</transition>
</template>

0 comments on commit 757d509

Please sign in to comment.