feat(projects): 增加返回顶部功能
This commit is contained in:
parent
d214bb2f2a
commit
894b0f1c18
@ -27,6 +27,7 @@
|
|||||||
<global-footer />
|
<global-footer />
|
||||||
</template>
|
</template>
|
||||||
</admin-layout>
|
</admin-layout>
|
||||||
|
<global-back-top />
|
||||||
<setting-drawer />
|
<setting-drawer />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -35,7 +36,15 @@ import AdminLayout from '@soybeanjs/vue-admin-layout';
|
|||||||
import { useAppStore, useThemeStore } from '@/store';
|
import { useAppStore, useThemeStore } from '@/store';
|
||||||
import { useBasicLayout } from '@/composables';
|
import { useBasicLayout } from '@/composables';
|
||||||
import { useBoolean } from '@/hooks';
|
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 app = useAppStore();
|
||||||
const theme = useThemeStore();
|
const theme = useThemeStore();
|
||||||
|
13
src/layouts/common/GlobalBackTop/index.vue
Normal file
13
src/layouts/common/GlobalBackTop/index.vue
Normal 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>
|
@ -5,5 +5,6 @@ import GlobalSider from './GlobalSider/index.vue';
|
|||||||
import GlobalContent from './GlobalContent/index.vue';
|
import GlobalContent from './GlobalContent/index.vue';
|
||||||
import GlobalFooter from './GlobalFooter/index.vue';
|
import GlobalFooter from './GlobalFooter/index.vue';
|
||||||
import GlobalLogo from './GlobalLogo/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 };
|
||||||
|
Loading…
Reference in New Issue
Block a user