feat(projects): 增加返回顶部功能

This commit is contained in:
燕博文 2022-06-17 15:59:56 +08:00
parent d214bb2f2a
commit 894b0f1c18
3 changed files with 25 additions and 2 deletions

View File

@ -27,6 +27,7 @@
<global-footer />
</template>
</admin-layout>
<global-back-top />
<setting-drawer />
</template>
@ -35,7 +36,15 @@ import AdminLayout from '@soybeanjs/vue-admin-layout';
import { useAppStore, useThemeStore } from '@/store';
import { useBasicLayout } from '@/composables';
import { useBoolean } from '@/hooks';
import { SettingDrawer, GlobalHeader, GlobalTab, GlobalSider, GlobalContent, GlobalFooter } from '../common';
import {
SettingDrawer,
GlobalHeader,
GlobalTab,
GlobalSider,
GlobalContent,
GlobalFooter,
GlobalBackTop
} from '../common';
const app = useAppStore();
const theme = useThemeStore();

View File

@ -0,0 +1,13 @@
<template>
<n-back-top :show="show" class="z-1000" />
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import { useWindowScroll } from '@vueuse/core';
const { y: scrollY } = useWindowScroll();
const show = computed(() => scrollY.value > 180);
</script>
<style scoped></style>

View File

@ -5,5 +5,6 @@ import GlobalSider from './GlobalSider/index.vue';
import GlobalContent from './GlobalContent/index.vue';
import GlobalFooter from './GlobalFooter/index.vue';
import GlobalLogo from './GlobalLogo/index.vue';
import GlobalBackTop from './GlobalBackTop/index.vue';
export { SettingDrawer, GlobalHeader, GlobalTab, GlobalSider, GlobalContent, GlobalFooter, GlobalLogo };
export { SettingDrawer, GlobalHeader, GlobalTab, GlobalSider, GlobalContent, GlobalFooter, GlobalLogo, GlobalBackTop };