vp-subnav.vue 717 B

123456789101112131415161718
  1. <script setup lang="ts">
  2. import { useSidebar } from '../composables/sidebar'
  3. import { useBackTop } from '../composables/back-top'
  4. import ToggleSidebarBtn from './subnav/toggle-sidebar-btn.vue'
  5. defineEmits(['open-menu'])
  6. const { hasSidebar } = useSidebar()
  7. const { shouldShow, scrollToTop } = useBackTop()
  8. </script>
  9. <template>
  10. <div class="sub-nav py-3 flex items-center">
  11. <ToggleSidebarBtn v-if="hasSidebar" @click="$emit('open-menu')" />
  12. <Transition name="shifting">
  13. <ElLink :class="{ 'go-back-top': true, show: shouldShow }" :underline="false" class="height-5" size="small" @click.prevent.stop="scrollToTop">{{ 'Back to top' }}</ElLink>
  14. </Transition>
  15. </div>
  16. </template>