mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-15 02:40:46 +08:00
a4063fd8d2
* docs: accessibility improvement for navbar * docs: accessibility improvement for demo * refactor: replace ElPopover with ElDropdown * docs: accessibility improvement for nav-full * docs: accessibility improvement for back-to-top * feat: add skip link that jump to the content
34 lines
817 B
Vue
34 lines
817 B
Vue
<script setup lang="ts">
|
|
import { useSidebar } from '../composables/sidebar'
|
|
import { useBackTop } from '../composables/back-top'
|
|
import ToggleSidebarBtn from './subnav/toggle-sidebar-btn.vue'
|
|
|
|
defineProps<{
|
|
isSidebarOpen: boolean
|
|
}>()
|
|
defineEmits(['open-menu'])
|
|
|
|
const { hasSidebar } = useSidebar()
|
|
const { shouldShow, scrollToTop } = useBackTop()
|
|
</script>
|
|
|
|
<template>
|
|
<div class="sub-nav py-3 flex items-center">
|
|
<ToggleSidebarBtn
|
|
v-if="hasSidebar"
|
|
:aria-expanded="isSidebarOpen"
|
|
@click="$emit('open-menu')"
|
|
/>
|
|
<Transition name="shifting">
|
|
<ElButton
|
|
:class="{ 'go-back-top': true, show: shouldShow }"
|
|
link
|
|
class="height-5"
|
|
@click.prevent.stop="scrollToTop"
|
|
>
|
|
Back to top
|
|
</ElButton>
|
|
</Transition>
|
|
</div>
|
|
</template>
|